Tuesday, December 13, 2011

Git is hard: applying single commits to another branch

Want to apply just one commit from one branch into another branch? Don't merge -- that'll bring in all the commits behind the one you want.

The secret is:
git cherry-pick <commit name>


To find the commit name, you can "git log <branch-that-has-the-commit>"
To see the contents of the commit, you can "git show <commit name>"

Be in the branch you want to change (git checkout <branch>) and then use cherry-pick to bring in exactly the fixes you want.

No comments:

Post a Comment