778 B
778 B
comments |
---|
false |
Cherry Pick
- Given an existing commit on one branch, apply the change to another branch
- Useful for backporting bug fixes to previous release branches
- Make the commit on the master branch and pick in to stable
Cherry Pick sample workflow
- Check out a new 'stable' branch from 'master'
- Change back to 'master'
- Edit '
cherry_pick.rb
' and commit the changes. - Check commit log to get the commit SHA
- Check out the 'stable' branch
- Cherry pick the commit using the SHA obtained earlier
git checkout master
git checkout -b stable
git checkout master
# Edit `cherry_pick.rb`
git add cherry_pick.rb
git commit -m 'Fix bugs in cherry_pick.rb'
git log
# Copy commit SHA
git checkout stable
git cherry-pick <commit SHA>