27 6 / 2011
commit git changeset to svn repository
As a software architect I often start to work on a project before it is correctly set up in our department. So there is no bug tracker, no svn repository and no ci process. For versioning I resently started to use git as a local version management system. To commit the changes to the svn repository, when it is set up, I use git-svn
To let my svn repository be known to my git repo I init the repository
git svn init --trunk=trunk https://version-control/svn/Projekt
Then I fetch all changes, which are non because the repo is empty.
git svn fetch
After that I can rebase all changes to the new branch remotes/trunk.
git rebase --onto remotes/trunk --root master
To link the git repository and the svn repository we use a git graft.
huegelph@242-2196-09:/cygdrive/d/Projekte/tbn> git show-ref trunk
c4e903dee0afb16679921fdc755e7c0340609669 refs/remotes/trunk
huegelph@242-2196-09:/cygdrive/d/Projekte/tbn> git log --pretty=oneline master | tail -n1
ce19033a70fbc6576d1e5751e71aa340fffbf460 Initialer Commit.
huegelph@242-2196-09:/cygdrive/d/Projekte/tbn> echo "ce19033a70fbc6576d1e5751e71aa340fffbf460 c4e903dee0afb16679921fdc755e7c0340609669" >> .git/info/grafts
Finally I merge all commited changes with git-svn.
git svn dcommit From then on I can use git or svn to interact with the repository and all my local commits are preseved.