Git : What is cherry pick

When specific commit from a certain branch and picked to some other branch it is called as cherry pick. Usually people work on different branches forked out of main branch in git repository. Now When we merge a branch in our branch we get all the commits, however when we pick specific commit from a branch to consumes or add it in our branch it is known as cherry pick.

There are several ways to do it, I would explain a simple way to do it using source tree.

1. Check out the branch you want to use or you want the commit to be picked up (consumed)
2. Choose to show all branches and not current branch only in drop down.
3. Now right click on the commit you want from other branch and select cherry pick option.
4. If there are not conflicts, every things is clean then you will get the cherry picked commit on your branch.
5. Push the commit to your origin.

 

  cherryPick

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s