Zach Posten - 2022 May 11
An update to an old post that only worked on Windows
Several years ago I wrote a blog post with the goal of creating an alias for
git rebase -i head~N, which I have always found quite irksome to type. The post overall is a bit preachy, but I stand by the problem it was trying to solve and the solution it provided.
The solution I gave in that post used a batch script, which will only work in Windows. In the intervening years, my development machine of choice has become a Mac, and my shell of choice ZSH.
Since making the switch to Mac, I have honestly missed my
i N alias for
git rebase -i head~N, and I hadn't put in the time to figure out a unix way to handle it...until today!
The solution is frustrating simple. So simple that I deeply regret it taking me this long to figure it out.
Open up your
~/.zshrc and drop in the following function:
Now reload your terminal, navigate to a git repository, and run
i 3. Done ✅