Git aliases for increased productivity

Published 10/12/2020

This article is part of a series:


It's been almost a year since I posted my first article on git aliases. Since then I've applied a number of additional aliases in my workflow. Be sure to check out my first article here to how I use "git update", "git nah", and "git amend".

Without further ado, here they are:

git arrange

This command lets you arrange all commits you made in a feature branch. Perfect for cleaning up commits before creating a PR.

git config --global alias.arrange "rebase -i develop"

git recent

If you often find yourself switching branches, this is a lifesaver. It will list all branches sorted by recent use.

git config --global alias.recent "branch --sort=-committerdate" # most recent branches

Check out my e-book!

Learn to simplify day-to-day code and the balance between over- and under-engineering.

git stash-unstaged

Ever wanted to stash your code, but keep everything you staged (with git add .)

git config --global alias.stash-unstaged "stash save --keep-index -u"

git undo-commit

This will allow you to remove the latest commit and move all the changes back into your working directory. With this, I often prefer committing instead of stashing code that I need for later, because it makes it so much simpler than searching through a list of stashes.

git config --global alias.undo-commit "reset HEAD~ --soft"

Let's see what's in stock for next year ✌️