Showing posts with label Subversion. Show all posts
Showing posts with label Subversion. Show all posts

Jan 22, 2014

How to create and apply a patch from an SVN Commit

Posted Jan 22, 2014
In subversion, there are cases that you may want to apply the same commit to another folder. E.g. you have a similar branch of your source code and you have committed the changes in your main branch. For this case, rather than copying your codes manually, you can create a patch from your SVN commit and apply it to another directory using the ff:

Create a patch from your commit, get the difference between two svn commits. Usually it's just your [desired commit #] minus one:
svn diff -r [reference commit]:[desired commit] > [filename]
e.g.
svn diff -r 9714:9715 > 9715.patch


Copy the patch file to the directory you want to apply it and go to that directory in the command line and type:
patch -p0 < [filename]
e.g.
patch -p0 < 9715.patch 

Nov 27, 2012

SVN Revert a file to a Previous Version

Posted Nov 27, 2012
svn merge -c -[revision number] [file]

e.g.
svn merge -c -80 Classes/MyClass.m
80 is the revision number

Or if you want your entire revert your workspace:
svn merge -c -80 .