Apply a single commit from another branch to the current branch

Lets say that you are work­ing on a fea­ture branch on which you also fixed some­thing crit­i­cal in one of the com­mits. Lets assume the com­mit hash is 7e877d2. The fix in this com­mit is required in another branch, say master.

To do this,
1. Check­out mas­ter
2. Cher­ryp­ick the commit

git checkout master
git cherry-pick 7e877d2

This just applies the changes in the men­tioned com­mit to your mas­ter branch.

Ryan Sukale

Ryan is a UX engineer living in San Francisco, California.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *