Skip to content

Instantly share code, notes, and snippets.

@tolleiv
Created June 15, 2016 09:44
Show Gist options
  • Save tolleiv/c998d16be907d4cb2ba9562854d1c0ca to your computer and use it in GitHub Desktop.
Save tolleiv/c998d16be907d4cb2ba9562854d1c0ca to your computer and use it in GitHub Desktop.
Some notes taken when we had to push a Git Repo to SVN
# http://caiustheory.com/adding-a-remote-to-existing-git-repo
git svn init -t tags -T trunk https://<svn-repo>/
git svn fetch
git remote add origin http://<git-repo>.git
git pull
svnCommit=`git show-ref trunk | awk '{print $1}'`
gitCommit=`git log --pretty=oneline master | tail -n1 | awk '{print $1}'`
echo "${gitCommit} ${svnCommit}" >> .git/info/grafts
git merge remotes/origin/master
git svn dcommit
--------------------------------
# http://caiustheory.com/adding-a-remote-to-existing-git-repo
git clone http://<git-repo>.git .
git pull
echo -e "[svn-remote \"svn\"]\n\turl = https://<svn-reppo>\n\tfetch = official/trunk:refs/remotes/trunk\n\ttags = official/tags/*:refs/remotes/tags/*" >> .git/config
git svn fetch
svnCommit=`git show-ref trunk | awk '{print $1}'`
gitCommit=`git log --pretty=oneline master | tail -n1 | awk '{print $1}'`
echo "${gitCommit} ${svnCommit}" >> .git/info/grafts
git svn dcommit
git pull && git svn dcommit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment