Tricks with SVN and Brace Expansion

SubVersionThere are loads of little tips and tricks out there on how to make your svn operations a little easier. One which I found out recently was how to leverage bash’s brace expansion to reduce key strokes.

Brace expansion definition

This powerful feature makes svn diff commands a lot easier.

To compare 2 branches of the same project:

bash$ svn diff svn://subversion-server/project-name/branches/{my-branch,older-version}

Which is the same as writing:

bash$ svn diff svn://subversion-server/project-name/branches/my-branch svn://subversion-server/project-name/branches/older-version

This technique can be used in any part of the svn path, so if you wanted to compare 2 projects with the same folder structure (not sure why you would) you can with:

bash$ svn diff svn://subversion-server/{my-project,cloned-project}/trunk/path/to/random/folder/

Which is the same as writing:

bash$ svn diff svn://subversion-server/my-project/trunk/path/to/random/folder/ svn://subversion-server/cloned-project/trunk/path/to/random/folder/

Hopefully this will help you save a little time when running svn diff commands

One thought on “Tricks with SVN and Brace Expansion”

Leave a Reply

Your email address will not be published. Required fields are marked *