How do I use ‘git rebase -i’ to rebase all changes in a branch?

Ok, I’m asuming the branch is called “feature” and it was branched from “master”.

There’s this little git command called merge-base. It takes two commits and gives you the first common ancestor of both of those. So…

git merge-base feature master

…will give you the first common ancestor of those two commits. Guess what happens when you pass that commit to git rebase -i, like…

git rebase -i `git merge-base feature master`

Interactive rebase from the first common ancestor of both master and feature branch.
Profit! 😉

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)