My favourite book for SVN (subversion) is Pragmatic Guide to Subversion.
So here we go with our list of FAQs in SVN. Should you like to add solutions to the problems you have had faced in this page, I encourage you to please use the comments section of this page. I shall sooner or later add it to the list of "Question and Answers" that we have for SVN, below.
- How to get the list of files that become a part of a particular commit in SVN repository?<br/> For every commit to svn, the repo generates a REVISION number. Using this revision number, we can fire the following command to get the list of files
svn log -qvr <revision>
(Also, read stackoverflow.com for more details)
- How to find the difference in file content between two revisions? <br/> Syntax: svn diff -r <PREV_REVISION>:<NEW_REVISION> <FILE_NAME>
Example: svn diff -r 3277:3278 app/models/account.rb
- How to get the list of files changed between two revisions? <br/> Syntax: svn diff -r <PREV_REVISION>:<NEW_REVISION> --summarize
Example: svn diff -r 3277:HEAD --summarize will list the files modified\added\deleted files since revision 3277 till current revision in the repo
- How to see the changes between two revisions, not mere list of file changes but the actual content difference between the revisions?
Syntax: svn diff -r <PREV_REVISION>:<NEW_REVISION>
Example: svn diff -r 3277:3276
- How to see the last 'N' commit logs?
Syntax: svn log -l <limit>
(or) svn log --limit <limit> Example: svn log -l 10 will display the last 10 commits' log messages
- How to see the last 'N' commit logs along with the list of [added\deleted\modified] files that were committed?
Syntax: svn log -vl <limit>
(or) svn log --verbose --limit <limit> Example: svn log -vl 10 will display the last 10 commits' log messages along with the list of modified files that were committed with each such commit.
- How to undo a commit in svn, when a commit's revision number is known?
Syntax: svn merge -r <UNDO_REVISION>:<UNDO_REVISION-1> <URL of trunk\branch where commit needs to be undone>
Example: svn merge -r 3278:3277 http://mysvnA1.thoughtworks.com/seesaw/branch/release_3.04/seesaw will undo the 3278 commit changes in your local code base which requires to be committed with perhaps the commit message like 'Commit to undo revision 3278 changes'
- How to merge a branch to a trunk (or vice-versa)?
Syntax: svn merge -r <REVISION_From#>:<REVISION_To#> <URL of the source branch (or trunk) from where the changes are taken>
Example: svn merge -r 250:HEAD http://mysvnA1.thoughtworks.com/seesaw/branch/release_3.04/seesaw will pick the changes from r250 to the last of the revision and merge all those changes to your local copy of trunk, assuming that you ran the above command from your local working directory that points to remote trunk. You may now review the local changes as a result of merge. If you are not satisfied with the changes you can revert it. If you are however happy with the changes you may commit them to the remote trunk.
- [More to come...]
Additional Reading Links:
- Read Chapter 9 - Subversion Complete Reference, at svnbook
FYI: There exists better alternatives to SVN as central repository. Some of them being Git, Mercurial etc.
Some cool books on Git, that I'm aware of are:
in that order. If in your experience there are better books that helped you understand Git better, please do share your experience in the comments section.
Mercurial is just another alternative to svn (or actually to Git). The one book that I'm aware of for this tool is Mercurial: The Definitive Guide (Animal Guide).