20

When I commit something to SVN, should I update first my local copy, or the merging is automatically done ?

In other words, should I always update before committing, or can I just commit ?

4 Answers 4

14

Yes you should.

While its not always necessary, it's a good idea to do so.

Imagine someone else changes something that wouldn't result in a conflict but has a reaction on your changes. Then, you would check in and the version on the server is not that what you tested.

So, before committing, always do an svn update to ensure that your changes still behave like you thought they do: test the version that is in your WC, if your commit is still reasonable, do it. In case of errors, fix them before committing to the repo.

12

Merging in Centralized Version Control Systems (CVCS) like subversion is always done before commits so you should update, test (if there are changes), then commit.

Good e-book -Version Control by Example (free) comparing CVCS and DVCS is available here

3
  • What in very big teams of programmers? let's say some hundred. Isn't there the chance that between your update and commit, another commit has been done?
    – MarioDS
    Oct 24, 2012 at 19:49
  • 3
    @MarioDeSchaepmeester sure, which is one reason why distributed version control systems are better for large teams.
    – steveax
    Oct 25, 2012 at 18:29
  • 1
    Important notice! Update befor commit should be proposed automatically by SVN if there is a new version in the repository!
    – Siyon DP
    Jul 29, 2018 at 14:43
4

No you don't need to. If your working copy is out-of-date and the SVN can't merge, then you will get a commit failed message. This is the time when you need to update and resolve conflicts, if there is any.

3

The merging is done to your working copy. Therefore, you should update first, in order to avoid conflicts. No harm is done, however, if you try to commit. If there are remote conflicting modifications, the commit will remain undone anyway.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.