Last Updated: February 25, 2016
·
771
· marc-andre

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...