It’s fairly well documented what to do if you have a subversion repository and want to develop on it with git. What if you have a project you started in a git repository, but now need to publish it to a subversion repo?
After several attempts and resets, this seems to be what you have to do to check a project you built with local git into an arbitrary place in a subversion repository.
- Make a new
gitrepo:mkdir ~/import; cd ~/import; git init - Make the new remote directory in the svn repo:
svn mkdir http://example.com/proj/ - Link up with the empty path using
git-svn:git svn clone -T '' http://example.com/proj/ - Add your original repo as a remote:
git remote add dev file:///home/username/work/proj git pull dev masterto pull in all the original git repo’s commits.git svn rebaseto rebase all the commits on top of the svn commit.- In my case, the rebase halted on some commits in the git history where I added files. I had to
git addthe files manually, thengit rebase --continue. git svn dcommit(or with-nto check… but it’s just a list of commit IDs, so it sure didn’t make me feel that much better about doing it)
You can then really check it worked by comparing the subversion content to your git repo:
cp -R ~/work/proj proj-gitrm -r proj-git/.gitsvn export http://example.com/proj/ proj-svndiff -rub proj-svn proj-git
As usual in UNIX, silence is golden.
Comments