Git Cherry-picking Smoothly

greenteabiscuit

Reishi Mitani

Posted on July 21, 2020

Git Cherry-picking Smoothly

Suppose you want to pull one specific commit of Branch AAA into Branch BBB. To do this, first we will have to see the commit logs of AAA.

$ git checkout AAA
$ git log

commit 8edb903383e879561f9ae0e289e55example (HEAD -> features/xxxx-yyyy)
Author: exampleauthor
Date:   Tue Jul 21 11:42:11 2020 +0900

    some commit message

Enter fullscreen mode Exit fullscreen mode

Make sure to write down the commit id 8edb.... somewhere.

Now we move to branch BBB, and cherry-pick the commit

$ git checkout BBB
$ git cherry-pick 8edb903383e879561f9ae0e289e55example
Enter fullscreen mode Exit fullscreen mode

When you check the logs in branch BBB, you will see that BBB now has the commit that was previously only in AAA!

// in branch BBB
$ git log

commit 8edb903383e879561f9ae0e289e55example (HEAD -> features/xxxx-yyyy)
Author: exampleauthor
Date:   Tue Jul 21 11:42:11 2020 +0900

    some commit message
Enter fullscreen mode Exit fullscreen mode
💖 💪 🙅 🚩
greenteabiscuit
Reishi Mitani

Posted on July 21, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related