Sometimes some of the branches in your git repository are not in use. We can’t merge them in master and the end action to remove them to clean our repository.
When we need Cherry-pick command
we check those Old branches we found several commits are useful that we can pick and use in our latest code. Now, what should we do to use this piece of code? You can not merge that branch otherwise you will have lots of conflict and Old code to deal with 🙁 The other option will be to copy that code and use it 😀 To handle such situation you have cherry-pick command in Git. which will allow you to Apply the changes introduced by some existing commits. You can directly use only that piece of commit changes without adding any additional code.
How to use cherry-pick command
To use cherry pick command you will need commit Hash.
You can copy commit Hash from any one of location and use it to cherry-pick that commit in your latest code.
Command to do cherry-pick
There are various other options available in cherry-pick command that you can use to extend the cherry-pick command functionality. take a look at this link