Safe interactive rebasing with git
I love editing my local commits with:
git rebase -i `git merge-base origin/master HEAD`
This starts an interactive rebase, starting from the last commit that has been pushed to origin/master
.
Note: git rebase -i origin/master
has a similar effect, but if you have an updated origin/master
(say after a git fetch
), that would allow you to both edit your commits and rebase onto the new origin/master
. I never want to do both at the same time...
Written by Marc-André Lafortune
Related protips
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#