Reputation: 8895
I was just wondering about something, I'm working on a project with several other programmers, we all use SVN for the project, I downloaded the svn tree to my local computer, and whenever I update something I commit it, up to now, everything is fine.
What if:
Thanks,
Upvotes: 1
Views: 92
Reputation: 45083
This is one of the main points of version control software, and this is what will happen:
A
A
The last part is where things get tricky - nobody wants to have to do this.
Also, SVN has the terrible habit of sometimes corrupting your source files all by itself when it merges, polluting code with <----- mine
and <------ theirs
left, right and centre - care needs to be taken in all cases.
There are a bunch or scenarios which could be explained to help educate you in this area, however this covers the general idea and a lot other knowledge will come with experience and practice.
Upvotes: 2
Reputation: 676
Actually 2nd developer don't know whether the file was modified by others or not before his commit. As soon as he do commit, it will give warning for version conflicting (because the file version from which he has done modification it has already been modified by others ).
You can then resolve the conflict BUT I think each developer should do SVN-UPATE before each commit, then you can overcome any unwanted situation.
Upvotes: 0
Reputation: 1
Most of the time SVN tries to merge the changes. If that is not possible it will give you a message that your commit failed and you need to update your checkout before trying to commit again.
That new update might give you conflicts that needs to be resolved. Though, it will never overwrite previous changes.
Upvotes: 0
Reputation: 2800
It won't overwrite it, but your modified version will become the latest revision. You'll need to merge your changes from your working copy to the previous revision.
If you're working on separate logical units with changes to the same code-base I'd recommend you branch your tasks and merge from branch to trunk once completed.
Upvotes: 0
Reputation: 218798
SVN will do its best to merge the changes both developers have made. If you're working in different parts of the file, it'll most likely handle this without a problem. If both developers are changing the same lines of the file, or for whatever reason the merge is more complicated than SVN can handle, it'll mark the file as conflicted and ask you to merge the conflicts manually (using a diff tool) when you try to update your local changes.
Basically, when you try to commit SVN will tell you that there are newer changes and you should update first. When you update it will conduct the merge on your local machine. Conflicted files will need to be fixed before you can commit. Once they're fixed and all changes merged, you can commit.
Upvotes: 6
Reputation: 10561
I think SVN will detect that the current file does not match the base version you were working with and ask you to do a manual merge.
Upvotes: 0
Reputation: 92752
The second person to commit the same file with the same revision will get a "SVN conflict" error, and it will be up to them to resolve it. See e.g. this: http://ariejan.net/2007/07/04/how-to-resolve-subversion-conflicts/
Upvotes: 2