简体   繁体   中英

git-svn after an SVN repository is moved?

We recently moved our SVN server from one data center to another, and the IP of the server has changed. I used svn switch --relocate old_url new_url to update my actual working copy, and that was happy.

However, I do most of my work in a local git version of the repository (using git-svn, obviously). After moving the SVN server, I updated the URL for the repo in .git/config , but when I try to use dcommit , I receive this error:

Unable to determine upstream SVN information from HEAD history.
Perhaps the repository is empty. at /home/me/libexec/git-core/git-svn line 520.

What am I missing?

In general, this isn't something that git-svn supports directly. The biggest hurdle is that git-svn uses the "git-svn-id" (visible in the commit log for each commit) to uniquely identify commits from SVN -- and the SVN URL is part of this ID. If the URL changes, it pretty much invalidates all of your existing history.

There are workarounds described here which look like they should work, but they aren't exactly simple and I haven't tried any of them myself.

It's possible to do this with git-svn by cloning both repos, merging them, then rebuilding the git-svn metadata.

See my answer here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM