Copying commits using Cherry-Pick

Cherry-Pick is a process to copy commits from one branch to another. It only copies the changes from the commits instead of copying all the changes available in a branch. Thus, it is completely different from what a merge or rebase performs.

You will need to perform Cherry-Pick on commits when you accidentally committed to a wrong branch and/or want to pull out a set of commits from your Bug-Fix branch to the master/feature branch as soon as those are available:

To Cherry-Pick, first checkout the branch where you want to copy a set of commits from a different branch. Then open the history of the other branch, from where you want to pull, by clicking on the View History... from the context menu, as shown in the preceding screenshot.

From the list of commit history, select the one that you want to pull to your current branch. Right click and select Cherry-Pick from the context menu, as shown in the preceding screenshot. This will pull the changes to the current branch. In case there are any merge conflicts, you will have to resolve those first before continuing.

Once the Cherry-pick process is successful, commit the changes and push them to your remote branch. You can repeat the process for each commit that you want to bring in your current checked-out branch.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.14.80.45