in Git by

What is git cherry-pick? What are the scenarios in which git cherry-pick can be used?

1 Answer

0 votes

Git cherry-pick is a powerful command to apply the changes introduced by one or more existing commits. It allows you to pick a commit from one branch and apply it to another.

git cherry-pick commitSha is the command used for cherry-picking. commitSha is the commit reference.

This command can be used for undoing changes. For instance, if by mistake you have made a commit to a wrong branch, then you can check out the correct branch and cherry-pick the commit to where it should belong.

It can also be used in team collaboration. There can be scenarios where the same code needs to be shared between two components of the product. In this case, if one developer has already written that code, then the other one can cherry-pick the same.

Cherry-picking is also useful in bug hotfixes where a patch commit can be cherry-picked directly into the master branch to fix the issue as soon as possible.

Click here to read more about GIT
Click here to read more about Insurance

Related questions

+2 votes
asked Jul 29, 2019 in Agile by sheetalkhandelwal
0 votes
asked Oct 15, 2019 in Git by rajeshsharma
0 votes
asked Jan 6 in Git by GeorgeBell
0 votes
asked Jan 9 in Git by SakshiSharma
0 votes
asked Feb 7 in Git by SakshiSharma
+1 vote