Phillip Pearson - web + electronics notes

tech notes and web hackery from a new zealander who was vaguely useful on the web back in 2002 (see: python community server, the blogging ecosystem, the new zealand coffee review, the internet topic exchange).

2008-6-18

git-svn: fun with branches and cherry-pick

More on git-svn: I'm getting the hang of using branches and rebase/cherry-pick to stage stuff before checking it in to a shared repository. This is for the situation where you're working on something and committing locally, and partway through you find and fix a bug or implement something that others care about. You want to check it in to the shared repository, but keep the rest of your stuff out of the way.

The trick here is to work on a branch (say work), and use git cherry-pick to copy the relevant commits back to the master branch, test them to make sure they don't depend on any of your other stuff, then git svn dcommit them. Then git checkout work; git rebase master to get back to your working branch and reorder your commits so that the ones you committed get pushed down in the history to the Subversion HEAD, and renamed appropriately, with git-svn tags etc.

If you've been working on master and have a few commits in there, and just want to check some of them in to Subversion, check out the last Subversion commit into a new branch, and go from there: git checkout -b svn <id of last git-svn commit> then cherry-pick etc as before, just using svn instead of master.

... more like this: []