The interactive rebase feature of Git is one of my favorites. I love being able to squash multiple commits into one commit or re-order my commits for clarity. My one complaint is the Git interactive rebase order is wrong (at least for the way my brain works).
Commits as a Stack
My mental model for commits is a stack, where items can be pushed on (or popped off) the top.
git log supports this model with the latest commits appearing on the top. On the other hand, by default
git rebase --interactive is reversed with the latest commits on the bottom.
Not the Only One
While I understand when something is appended to a file it goes on the end of the file and this mental model matches how commits are displayed with Git interactive rebase, that knowledge does not help change the fact that I need to perform a mental shift when I switch between
git log and
git rebase --interactive
I’m not the only one who feels it would be more intuitive if the order of commits in git interactive rebase were reversed (post from May 2011).
Since I use Vim as my editor when working with Git, I wrote a Vim plugin to reverse the order of the commits in an interactive git rebase.
With the plugin
Note the interactive rebase window on the right now has the most recent commits on the top.