kch kch - 1 year ago 120
Git Question

git-svn: what's the equivalent to `svn switch --relocate`?

An svn repository I'm mirroring through git-svn has changed URL.

In vanilla svn you'd just do

svn switch --relocate old_url_base new_url_base

How can I do this using git-svn?

Simply changing the svn url in the config file fails.

kch kch
Answer Source

This handles my situation pretty well:


I cloned using the file:// protocol, and wanted to switch to the http:// protocol.

It is tempting to edit the url setting in the [svn-remote "svn"] section of .git/config, but on its own this does not work. In general you need to follow the following procedure:

  1. Switch the svn-remote url setting to the new name.
  2. Run git svn fetch. This needs to fetch at least one new revision from svn!
  3. Change the svn-remote url setting back to the original URL.
  4. Run git svn rebase -l to do a local rebase (with the changes that came in with the last fetch operation).
  5. Change the svn-remote url setting back to the new URL.
  6. Now, git svn rebase should work again.

Adventurous souls may want to try --rewrite-root.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download