Skip to content

Cherry picking a commit

Vijay Selvaraj edited this page Sep 8, 2020 · 1 revision

What is cherry-pick?

"git cherry-pick" helps to append an individual commit(s) from one branch into your current HEAD branch.

How to cherry-pick?

  • Update your local repo to get latest changes from the remote repo
$ git pull origin main
  • Find a commit reference
git log
  • Cherry pick a commit
$ git cherry-pick <commit hash>
$ git cherry-pick 649ab0a

Cherry pick a change from sprint branch to main (in your fork)

a - b - c      (Main branch)
     \
      d - e    (Sprint branch)

Let us consider the above example. Follow the below steps to cherry pick e from sprint branch to main.

$ git checkout main
$ git pull origin main

$ git cherry-pick e
$ git push

Now e is available in the main branch of your fork (user/rdkservices). Submit a Pull Request to upstream repository (rdkcentral/rdkservices)

Clone this wiki locally