Taken from @CommitStrip |
One would thought this would be as simple to run svn switch --relocate or just edit the .git/config file and change the svn-remote URL, but then again, this is SVN..
Just in case I backed-up the svn server and the .git/config file, then I tried the instructions below:
Edit .git/config and change the URL in svn-remote tag
git svn fetch
Edit again the .git/config file and replace the URL with the old one.
git svn rebase -l
Change (again) the URL at .git/config file to the new one.
git svn rebase.
But this yielded no result, when trying to rebase I got the following error:
Unable to determine upstream SVN information from working tree historyAs explained Here this will only works if the fetch command actually fetch anything, it was not my case, so I tried the following:
git svn info # double check UUID's
git config svn-remote.svn.rewriteRoot OLD_URL.
git config svn-remote.svn.url NEW_URL.
git svn fetch --parent.
git svn rebase.
This did the trick, as explained below this will not break the history as the old URL will still be used in the commits, but it didn't matter to me.
Git-svn couples git commits to the origin SVN repository by embedding the original SVN url in the commit. Changing this url will change the Git commit SHA (basically rewrite all your history). Google results furnish various elaborate schemes for reconfiguring and patching up the Git repo, but the safest approach involves using built-in support for "rewriting" the Git-svn root url. This effectively tells Git to continue using the original SVN url for purposes of Git history, but use an independent URL (the new location) for actually retrieving and commit deltas (you will have to live with the old url in your commit history, but most likely you will be the only one that sees that).
No comments:
Post a Comment