Git Cherry Pick
Git Cherry-Pick
- Definition: - git cherry-pickapplies changes from a specific commit to your current branch.
- Summary: Copies a single commit to another branch without merging the whole branch. 
- Use Case: Pick select bug fixes or features from another branch without full merge. 
Tasks
- Ensure you have access to the - storage serverwhere the repository is cloned at- /usr/src/kodekloudrepos.
- Navigate to the - /usr/src/kodekloudreposdirectory which contains the repository.
- Identify the commit on the - featurebranch with the message- Update info.txt.
- Merge the identified commit from the - featurebranch into the- masterbranch.
- Push the updated - masterbranch to the remote repository located at- /opt/official.git.
Steps
SSH into the storage server and get root
ssh natasha@ststor01
sudo su -Navigate to the repo
cd /usr/src/kodekloudrepos/officialFetch all branches to be sure you’re updated
git fetch --allCheck out the master branch
git checkout masterFind the commit hash from feature branch with message "Update info.txt"
git log feature --grep="Update info.txt" --oneline
Push the updated master branch to remote
git push origin master
Last updated
