Quickly backport fixes into bugfix branches
My bug fixing workflow usually is as follows:
- Fix bug in master, polish, test, etc.
- Lookup SHA1 of the commit
- Switch to bugfix branch
- Do
git cherry-pick $SHA-1
to backport the issue
If you add the following aliases
last = !git log -n 1 --pretty=format:%H $1
cp-last = !git cherry-pick `git last $1`
This can be shortened to:
- Fix bug in master, polish, test, etc.
git checkout $bugfixBranch
git cp-last master
The last
alias discovers the SHA-1 of the last commit of the given branch. cp-last
uses this command to cherry pick this commit into the current branch.
Written by Oliver Gierke
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Branch
Authors
niklongstone
41.97K
muzzlefork
11.98K
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#