Not a subscriber?

Join thousands of others who are building self-directed lives through creativity, grit, and digital strategy—breaking free from the 9–5.
Receive one free message a week

Productivity Boost: The SVN Switch Command

If you’re working in a shop that uses SubVersion and also utilizes any form of branching you will probably run into a point in time where you have 10 different copies of your source tree on your disk. Usually you will have one copy per branch. If your project is small this usually isn’t a problem, but if your project is large it is a royal pain. At my current gig our project contains well over 35K files. That’s not lines of code, that’s actual number of files. It’s _huge_.

Solution: Use the svn switch command.

The svn switch command does the following:

This subcommand updates your working copy to mirror a new URL—usually a URL which shares a common ancestor with your working copy, although not necessarily. This is the Subversion way to move a working copy to a new branch. [source]

In english: If you branch from the same location each time you can switch between where your local copy points. At this point your local copy is acting as a local pointer to a particular location in source control. Maybe today you’re working on the trunk, then maybe tomorrow you’re working on a few bugs for the version 2 branch, etc. You can easily switch between them using this command.

Switching with Tortoise SVN

This is super easy.

Right click the source of where you would like to branch.

image

 

Select the Url (click the ellipses)

image

Select your location of your branch (click to enlarge):

image

Then click ok on the “Switch To Branch/Tag” window.

The switch dialog will appear informing you what files it has downloaded/updated/deleted to get you to the current state of that branch (click to enlarge):

image

That’s it! Now you’re connected to your branch!

 

Benefit

The benefit here is simple: Productivity. If you have a very large tree (as I noted above) you can run into instances where downloading the entire tree can take 5-10 minutes. If you’re doing a lot of branch switching this can be a major time drain. Switching nearly eliminates this slow down from 5-10minutes to 10-15 seconds. Plus, you only have _one_ copy of the tree on your machine at any time. That’s also very nice as otherwise you could have a major file party happening on C:\.   🙂

Enjoy