Monday, August 22, 2011

Switching a Working Copy in SVN

Use "svn switch" for this. It's not very painful, and it keeps your local changes. Basically, it's "svn update" on steroids: not only does it update to the latest modifications in the repository (again, keeping your local changes), it also relocates where your working copy is "looking to" to know what has been changed. Think of your local working copy as keeping its eye on the master list of files and changes. Now, that gaze has shifted elsewhere, perhaps to a branch. This is fantastic, for example, if you want your current local modifications to be checked into a branch instead of the head. Just use svn switch, and then you'll be interacting with a different batch of project files.

The command itself is simple:

svn switch new/repository/location

The new repository location could be a file:/// location, if you're doing this on the same server on which the repository resides, or an https:// location, if it's remote. Be sure to include the full path, including any directories, like /trunk or /braches/new-branch.

No comments:

Post a Comment