Document

SUBSCRIBE TO GET FULL ACCESS TO THE E-BOOKS FOR FREE 🎁SUBSCRIBE NOW

Professional Dropdown with Icon

SUBSCRIBE NOW TO GET FREE ACCESS TO EBOOKS

git- cherry-pick

git cherry-pick is a powerful command that enables arbitrary Git commits to be picked by reference and appended to the current working HEAD. Cherry-picking is the act of picking a commit from a branch and applying it to another. 

Example 

Create some commits in the dev branch and merge a particular commit in the main branch


  • git branch dev
  • git checkout dev
  • touch dev.java dev1.java
  • git add .
  • git commit -m “dev.java file is added” dev.java
  • git commit -m “dev1.java file is added” dev1.java
  • git log –oneline
  • git checkout –
  • git cherry-pick 6f39b22
  • git log –oneline
  • git cherry-pick 478bfdb -n # merge commit in stage area
  • git status
  • git commit -m “dev1.java”
Share your love

Leave a Reply

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