Rebasing relative to a commit
When rebasing a series of git commits, you may know that if you supply the sha of a commit, the rebase operation will start at the commit that comes immediately after. If you want to include the commit specified by the hash, or any other commit relative to that one, you can use the tilde operator, so
git rebase -i 5524dc9~1
would start an interactive rebase with the pointer moved back one commit,
git rebase -i 5524dc9~2
would move the pointer back two commits, and so on.
Written by Craig Marvelley
Related protips
1 Response
That's cool! I've always done HEAD~number
before where the number is how many commits back from head I want to go so this will save some effort I think :)
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Rebase
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#