Read more

Git: Merge a single commit from another branch

Tobias Kraze
August 31, 2010Software engineer at makandra GmbH

This is called "cherry-picking".

git cherry-pick commit-sha1
Illustration web development

Do you need DevOps-experts?

Your development team has a full backlog? No time for infrastructure architecture? Our DevOps team is ready to support you!

  • We build reliable cloud solutions with Infrastructure as code
  • We are experts in security, Linux and databases
  • We support your dev team to perform
Read more Show archive.org snapshot

Note that since branches are nothing but commit pointers, cherry-picking the latest commit of a branch is as simple as

git cherry-pick my-feature-branch

Be aware that cherry-picking will make a copy of the picked commit, with its own hash. If you merge the branch later, the commit will appear in a history a second time (probably without a diff since there was nothing left to do).

Also see our advice for cherry picking to production branches!

Posted by Tobias Kraze to makandra dev (2010-08-31 09:47)