Phil for Humanity Phil for Humanity
A Guide for the Survival of Humankind and Helping the World, Society, and Yourself.

Git Cherry-Pick

If you do not want to merge an entire branch, you have the option to merge a single SHA or even a range of SHAs. To merge a single SHA, use this command:

git cherry-pick –x SHA

I strongly recommend always using the "-x" when cherry-picking to automatically include a description in the new commit’s remark about what SHA was merged.

To merge a range of SHAs, use this command:

git cherry-pick –x SHA1..SHA2

This command will merge all the SHAs from SHA1 to SHA2. I find this option to be useful when merging only the beginning of branch, thus not merging the latest changes from a branch.

by Phil for Humanity
on 11/05/2012

Related Articles
 » Git Merge-Base: How to Get the Last Merged SHA
 » Git Rebase Walk Through
 » Git Merge Fast Forward versus No Fast Forward