Skip to content

Instantly share code, notes, and snippets.

@fedecarg
Last active December 14, 2015 15:28
Show Gist options
  • Save fedecarg/5107738 to your computer and use it in GitHub Desktop.
Save fedecarg/5107738 to your computer and use it in GitHub Desktop.

SVN Notes

Prop

Ignore files and directories:

svn changelist ignore-on-commit <file>
svn propset svn:ignore <dir> .
svn propedit svn:ignore .

Branch

List branches

svn ls svn://repo/branches

Create branch

svn copy svn://repo/trunk svn://repo/branches/branch-name -m "Branching from trunk at r1234"

Delete branch:

svn delete svn://repo/branches/branch-name -m "Removing branch from the repository"

Copy changes from trunk to branch

svn update
svn status 
svn log --limit 500 | grep -B 3 branch-name
# outputs rev number 1
svn info svn://repo/trunk | grep Revision
# outputs rev number 2
svn merge -r 1:2 svn://repo/trunk .

Copy changes from branch to trunk

svn log --stop-on-copy
# outputs rev number 1
svn switch svn://repo/trunk
svn update
# outputs rev number 2
svn merge -r 1:2 svn://repo/branches/branch-name
svn commit -m "Merged branch branch-name into trunk"

Reverts all changes that have not been committed

Works by doing svn status then parsing the resource file path out of each line and passing them all as a list to svn revert. Only files under version control are affected.

svn st inc data | awk '{print $NF;}' | xargs svn revert

Delete all unversioned files from inc and data

Works similarly to the above but parses resources out of each line that start with a ? and passing them all as a list to rm.

svn st inc data | awk '/^\?/ {print $NF;}' | xargs rm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment