Should we always update before committing in SVN?
When I commit something to SVN, should I update first my local copy, or the merging 开发者_如何学Cis automatically done ?
In other words, should I always update before committing, or can I just commit ?
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.
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
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.
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.
精彩评论