Rebasing all commits since branching
If you just want to rebase all the commits that are new in your branch, since the time you branched from the parent branch, it would be easier to just have the following alias in your config:
rbi = !sh -c \"git rebase -i `git merge-base $1 HEAD`\" -
Then, if you wanted to rebase all the commits you've added to your current branch, you could simply run:
git rbi parentBranch
This approach uses an argument, but instead of having to know how many commits to go back, you just supply the branch name, and it figures out most recent commit shared between the current branch and the parent branch via git merge-base
Why this, rather than git rebase -i parentBranch
The reason you would do this rather than a straight git rebase -i parentBranch
is that you might not want to deal with the merge-conflicts until a later point, or even deal with a merge-conflict in one commit, and then the same conflict on the same line in another commit. See https://mcmap.net/q/12525/-how-do-i-use-39-git-rebase-i-39-to-rebase-all-changes-in-a-branch