Programster's Blog

Tutorials focusing on Linux, programming, and open-source

SVN Cheatsheet

Partial Merge

Sometimes branches get way out of date and merging all updates from trunk causes way too many conflicts to handle at once. In this case you may want to merge updates from trunk in stages which are easier to handle.

The command below will only sync updates from revisions 5100 to 5150 in trunk down into your branch (assuming you already navigated to within that directory)

svn merge \
-r5100:5150 \
svn://svn.my-site.org/project/trunk .

If you did a partial merge before (in this case up to revision 5150) and now want to grab all remaining updates, then just use HEAD like so:

svn merge \
-r5150:HEAD \
svn://svn.my-site.org/project/trunk .

Revert (Undo) A Specific Revision

If you made a commit that shouldn't have gone through, it's easy enough to undo. Just find out the ID of that revision and run the command below:

svn merge -c -[revision number] .

Revert (Undo) A Range of Revisions

This is just like before but will undo a range of revisions. I have never had to use this.

svn merge -r [upper revision number]:[low revision number] .

References

Last updated: 16th August 2018
First published: 16th August 2018