Name

switch

Synopsis

svn switch URL [path]

This subcommand updates your working copy to mirror a new URL--usually a URL that 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.

As with most subcommands, you can limit the scope of the switch operation to a particular tree depth using the --depth option. Alternatively, you can use the --set-depth option to set a new “sticky” working copy depth on the switch target. Currently, the depth of a working copy directory can only be increased (telescoped more deeply); you cannot make a directory more shallow.

Alternate names: sw

Changes: working copy

Accesses repository: yes

Options

--accept arg
--depth arg
--diff3-cmd cmd
--force
--ignore-externals
--quiet (-q)
--relocate
--revision rev, -r rev
--set-depth arg

Examples

If you’re currently inside the directory vendors, which was branched to vendors-with-fix, and you’d like to switch your working copy to that branch:

$ svn switch http://svn.red-bean.com/repos/branches/ \
> vendors-with-fix .
U  myproj/foo.txt
U  myproj/bar.txt
U  myproj/baz.c
U  myproj/qux.c
Updated to revision 31.

And to switch back, just provide the URL to the location in the repository from which you originally checked out your working copy:

$ svn switch http://svn.red-bean.com/repos/trunk/vendors .
U  myproj/foo.txt
U  myproj/bar.txt
U  myproj/baz.c
U  myproj/qux.c
Updated to revision 31.

Tip

You can just switch part of your working copy to a branch if you don’t ...

Get Linux in a Nutshell, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.