Computing Magazine

Pull Single Commits with GIT Cherry Picking

Posted on the 28 March 2012 by Akahgy


We need to pull into a separate branch a few number of commits from another branch.


GIT version control tool offers the solution: cherry picking.

Commit your changes to the branch, and tell GIT you want to use selected branch commits, by using the commit hash you can find in the log.

First, get the commit hash from the log:

$ git log -1

Then, cherry pick only the desired commit, and pull it into your branch:

$ git cherry-pick <commit hash>

That’s it, now the cherry picked commits will be merged into your branch, without having the whole other branch.

Back to Featured Articles on Logo Paperblog