git cherry-pick

What is git cherry-pick

In git, Cherry picking means to choose a commit from one branch and apply it onto another.

Basic Syntax: git cherry-pick <commit-hash>

Cherry picking will merge the specify commit to your current checkout branch.

When we need cherry pick

Suppose we have three branch – say master branch, feature branch and testing branch. We are working in a feature branch that is not ready for merging into master branch (for release and testing). But we want to push an update to master for releasing purpose (for major error or else). We don’t want to merge full feature branch to master.

In this type of situation- Git’s cherry-pick is really useful.

 

the possible step will be as follows:

Step1: git checkout master

step2: git checkout -b quick-fix

step3: git cherry-pick <target-commit-hash>

 

That’s it. Now you can merge this branch to your testing branch for testing purpose. After testing we can release the update.

To learn more about cherry click here

 

About the Author: Md. Delwar Hossain

He has 11 years of experience in developing standalone software and web applications for multiple database platforms. He has been passionate about new tools and technologies. He is positive and trustworthy. He is capable to learn and adapt quickly to different situations. He is a great team player and enjoys leading and mentoring. He is specialized in architecting and building complex web and mobile application. He has strong skills to automate POS, inventory, supply chain, trading export/ import, human resource management, manufacturing and production, distribution management system and hospital management system.

1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *