Git Cherry Picking
Posted on August 28, 2020 in Git by Matt Jennings


Cherry picking in Git means to choose a commit from one branch and apply it onto another.


  1. I have two branches, master and exercize2.
  2. Switch to branch master and create a new file with text:
    echo 'Master of the Universe!' > master.txt
  3. Commit that change on master and switch to exercise2 branch.
  4. While on the exercise2 branch, cherry pick that specific master branch commit SHA1 by using something like below which will create a new commit:
    git cherry-pick 5a07a80
  5. Or to NOT create a new commit while cherry picking:
    git cherry-pick 5a07a80 -n

Leave a Reply

To Top ↑