Definition: git cherry-pick applies changes from a specific commit to your current branch.
git cherry-pick
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.
Ensure you have access to the storage server where the repository is cloned at /usr/src/kodekloudrepos.
storage server
/usr/src/kodekloudrepos
Navigate to the /usr/src/kodekloudrepos directory which contains the repository.
Identify the commit on the feature branch with the message Update info.txt.
feature
Update info.txt
Merge the identified commit from the feature branch into the master branch.
master
Push the updated master branch to the remote repository located at /opt/official.git.
/opt/official.git
SSH into the storage server and get root
ssh natasha@ststor01 sudo su -
Navigate to the repo
cd /usr/src/kodekloudrepos/official
Fetch all branches to be sure you’re updated
git fetch --all
Check out the master branch
git checkout master
Find the commit hash from feature branch with message "Update info.txt"
git log feature --grep="Update info.txt" --oneline
git cherry-pick 0e3895a
Push the updated master branch to remote
git push origin master
Last updated 7 months ago