Over a million developers have joined DZone.

Switch Your Subversion Working Copy

· DevOps Zone

The DevOps zone is brought to you in partnership with Sonatype Nexus. The Nexus suite helps scale your DevOps delivery with continuous component intelligence integrated into development tools, including Eclipse, IntelliJ, Jenkins, Bamboo, SonarQube and more. Schedule a demo today

Apache Subversion’s ‘svn switch’ command allows users to update a working copy to a different URL. This is useful when you need to update your working copy to mirror a newly-created branch.

Although it’s possible to achieve the same effect by performing a fresh checkout, the ‘svn switch’ command is a quicker alternative. It saves you the overhead of running ‘svn checkout,’ and applies the changes required to bring your working copy inline with the new location, making it a very efficient command. It also preserves any changes you’ve made in the working copy.

To perform a switch, run ‘svn switch’ followed by the URL path you wish to mirror. Apache Subversion will then go ahead and update your working copy.

svn switch

Additional Options

There are some additional options you can apply to fine-tune the ‘svn switch’ command:

  • Ignore Ancestry

If Subversion cannot find a common ancestor for the URL and your working copy, it will block the operation and display an error message.

svn switch 2

It is possible to force Subversion to switch to this URL anyway, by adding the –ignore-ancestry option.

svn switch (target-URL) –ignore-ancestry

svn switch 3

  • Target a Particular Revision

You can also specify a particular revision of the URL you’re switching to. Note that Subversion defaults to the HEAD revision, if no alternate revision is specified:

svn switch -r(revision-number) (target-URL)

svn switch 4

The DevOps zone is brought to you in partnership with Sonatype Nexus. Use the Nexus Suite to automate your software supply chain and ensure you're using the highest quality open source components at every step of the development lifecycle. Get Nexus today


Published at DZone with permission of Jessica Thornsby, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}