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.
The first svn relocate syntax allows you to update one or more working copies by what essentially amounts to a find-and-replace within the repository root URLs recorded in those working copies. Subversion will replace the initial substring FROM-PREFIX with the string TO-PREFIX in those URLs.
When moving to Git from another version control system like Subversion (SVN), we generally recommend that you perform a "tip migration", which migrates just the latest version of the repository contents, without including history.
SVN stands for Subversion. So, SVN and Subversion are the same. SVN is used to manage and track changes to code and assets across projects.
This handles my situation pretty well:
https://git.wiki.kernel.org/index.php/GitSvnSwitch
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:
url
setting to the new name.git svn fetch
. This needs to fetch at least one new revision from svn!url
setting back to the original URL.git svn rebase -l
to do a local rebase (with the changes that came in with the last fetch operation).url
setting back to the new URL.git svn rebase
should work again.Adventurous souls may want to try --rewrite-root
.
You can see if the following works OK:
If svn-remote.svn.rewriteRoot
does not exist in config file (.git/config
):
git config svn-remote.svn.rewriteRoot <currentRepositoryURL>
If svn-remote.svn.rewriteUUID
does not exist in config file:
git config svn-remote.svn.rewriteUUID <currentRepositoryUUID>
The currentRepositoryUUID
can be obtained from .git/svn/.metadata
.
git config svn-remote.svn.url <newRepositoryURL>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With