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.

Alternate Names:

sw

Changes:

Working copy

Accesses Repository:

Yes

Options

--config-dir dir

--password pass

--diff3-cmd cmd

--quiet (-q)

--no-auth-cache

--relocate

--non-interactive

--revisionrev, -rrev

--non-recursive (-N)

--username user

Examples

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

    $ svn switch http://svn.red-bean.com/repos/branches/fixed .
    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 want to switch your entire working copy.

Sometimes an administrator might change the “base location” of your repository—in other words, the contents of the repository doesn’t change, but the main URL used to reach the root of the repository does. For example, the hostname may change, or the URL schema, or perhaps just the path ...

Get Unix in a Nutshell, 4th 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.