git-cherry-pick is great command. It allows you to take a single commit made elsewhere and commit it to your workin g tree. From the man page:
Given one existing commit, apply the change the patch introduces, and record a new commit
that records it. This requires your working tree to be clean (no modifications from the
Today I was working on something and bumped into a bug that I had fixed in a release branch.
I looked up the ticket for the bug and saw that it was fixed in svn revision 7624. So in order to find that commit in git I did
git co 1.1
SHA=`git svn find-rev r7624`
Now I want this change in my 1.2 branch
git co 1.2
git cherry-pick $SHA
All is well and good, until....
Author: chriso <chriso@44e5888c-930d-754b-aefa-77e11abcc7dd>
Date: Tue Feb 26 15:02:55 2008 +0000
Working around a monorail change that broke me reseting the session state in the reset method of the wizard step. [refs #304]
git-svn-id: https://buildserver/svn/repos/tags/1.1@7624 44e5888c-930d-754b-aefa-77e11abcc7dd
See that git-svn-id line? If I leave it as is when I dcommit my 1.2 branch (which goes to trunk in svn) it will make the commit to the tags/1.1 branch in svn because that is where the most recent git-svn-id points to.
The workaround is actually quite simple
git cherry-pick -n $SHA
What this will do is stage the changes but not commit. Now I can git-commit myself and remove the git-svn-id line.