Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should we always update before committing in SVN?

Tags:

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 ?

like image 399
aneuryzm Avatar asked Aug 17 '11 06:08

aneuryzm


People also ask

What is difference between commit and update in svn?

Commit uploads your changes on the CVS / SVN server, and Update overwrites the files on your localhost with the ones on the server.

How do I commit changes in svn?

Select any file and/or folders you want to commit, then TortoiseSVN → Commit.... The commit dialog will show you every changed file, including added, deleted and unversioned files. If you don't want a changed file to be committed, just uncheck that file.

What is the use of svn update?

The SVN update Command. The svn update command lets you refresh your locally checked out repository with any changes in the repository HEAD on the server. It also tells you what has been changed, added, deleted. If a change has been made to a file you have also changed locally, svn will try to merge those changes.

What is the use of svn commit command?

svn commit will send any lock tokens that it finds and will release locks on all PATH s committed (recursively) unless --no-unlock is passed. If you begin a commit and Subversion launches your editor to compose the commit message, you can still abort without committing your changes.


2 Answers

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.

like image 169
eckes Avatar answered Sep 19 '22 09:09

eckes


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

like image 25
steveax Avatar answered Sep 20 '22 09:09

steveax