Tuesday, March 20, 2012

git svn commit trick

Speed Dreams uses SVN. I prefer git. That leads to git svn.

I've just invented for myself a new trick to use when I want to commit only some of my git commits to the central SVN repo. As often, git branching comes as a life-saver - I make a branch for SVN committing, remove the commits I don't want to push to SVN, do git svn dcommit, switch back to master and delete the temporary branch:
git checkout -b svnci
git rebase -i HEAD~6 (usually that is quite enough)
in rebase: remove the commits I don't want to send to SVN
git svn dcommit
git checkout master
git svn rebase
git branch -d svnci
I still have to learn each day the use of easy branching in git. Maybe put up a poster somewhere "Did you branch something today?" :)

PS: of course I've found I did reinvent the wheel. Damn I hate googling :s I've found an article from 2009 from a Mozilla dev about partial git svn commits: http://fredericiana.com/2009/12/31/partial-svn-dcommit-with-git/
While it is not the same technique, it is very much alike. And then you reach the comments... and *bang* there is my shiney new trick all put down 2 years ago :(((

No comments:

Post a Comment