SVN update and changes on out-of-date file

367 Views Asked by At

How exactly svn update work? I know that it brings all the changes on the svn copy into your local one.

I have out-of-date file that prevented my copy to be committed with the error:

file 'somename' is out of date

The most occurring solution on SO is to do an svn update command and then svn commit.

But, wouldn't that let me lose the changes I made on my files on my local copy including the out-of-date one?

2

There are 2 best solutions below

5
On BEST ANSWER

You can take a backup of local file and get the svn update. Later use any file comparison tool to merge back your changes. Beyond Compare is usually what I use to merge large files. Or else if you are using eclipse with SVN plugin it is much more simpler. Right click on project or file go to Team > Synchronize with Repository. You will see Team Sync view in that you should see your file under outgoing changes or in conflict. Double click on file to be merge and then merge svn file with local. Once everything is done right click on file and Click on Mark as Merged. Finally check in the file.

0
On

Does it "let you" lose your changes? Sure, I guess. Is it likely to lose your changes? Not at all. Will it silently clobber your changes? Absolutely not.

Doing an svn update will merge the repository changes into your working copy. Assuming you are working with textual files, this means if you made changes to the same lines as the repository changes, you will get a "merge conflict" which you must manually resolve. Thus if you lose your changes, it's because you messed up while resolving conflicts, not because of anything SVN did.