Question

  1. Few days ago I "updated" my local copy of the source code (i.e. I took the code from the SVN repository).
  2. After that the code was changed by other people and committed to the repository.
  3. Now I want to make some changes to the code and also commit it to the repository.

How can I do it?

The first answer that comes to mind is: Make your changes and "svn commit" them. However, in this case it will look like I try to remove the changes that were added by other users. Moreover, it might be that recently I accidentally made some changes to the code that I did not meant to do.

The second answer that comes to mind is: First, "svn update" your local code then make your changes and then "svn commit" them. However, in this case "update" will try to merge the new code from the svn server with my code that may contain the above mentioned accidental undesired changes from me.

The third answer that comes to mind is: First, "svn revert", make your changes and then "svn commit". But it also will not work, because by "svn revert" I do remove my accidental changes (this is good) but I get the old version of the code and if I try to "svn commit" it to the svn server, it will look like I try to remove the changes done by other.

So what is the solution. To summarize, I want to get the newest version of the code from the SVN repository and I do not want to merge this code with my local changes (I want to overwrite my local changes).

Was it helpful?

Solution

There are two things you can do:

  1. Check out a new clean working directory. No reason why you can't. Advantage, it doesn't touch your stuff.
  2. Revert your changes after you do an update. That will get you a clean checkout, but you will lose all of your changes.

Normally, you want to keep the changes you did and merge them back into the changes others have done. If you need a clean checkout, checkout a new working directory. That's the easiest and it keeps your changes. If you don't want your changes, revert them, run svn status to verify you have no changes in the working copy (or nonversioned files), and then do an update. It will be a bit faster than a new clean checkout.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top