Shortening Git With Aliases

Shortening Git With Aliases

21 October 2026 · By Laravel Git · 2 min read

You will type git status ten thousand times this year. Aliases turn the frequent commands into a few keystrokes, and the long flag combinations into something you no longer have to remember.

Setting them#

git config --global alias.st status
git config --global alias.sw switch
git config --global alias.br branch

git st now runs git status. Aliases live in your ~/.gitconfig under [alias] - plain text, editable directly when you outgrow the command line form.

The ones that earn their keys#

The graph view from the history guide, as two letters:

git config --global alias.lg "log --oneline --graph --decorate --all"

A safe undo for the commit you just made:

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

And the fixup workflow paired with autosquash:

git config --global alias.fixup "commit --fixup"

git fixup abc1234 marks a commit as belonging to an earlier one; git rebase -i --autosquash main then folds it in automatically. That pair is the fastest way to keep a branch tidy as you go instead of in one pass before review.

Anything beyond one git command gets a ! prefix to run through the shell - alias.today = "!git log --since=midnight --oneline".

The honest limits#

Aliases are yours, not the repo’s. They do not exist on a teammate’s machine, in CI, or on a fresh laptop until you recreate them - so scripts, hooks and documentation must always use the full commands, and the aliases belong in your dotfiles backup, not in project tooling. And keep the list short: an alias you have to look up defeats the point. Five you use hourly beat fifty you typed once.

If a command pair keeps recurring across the whole team, that is a sign it wants to be documentation or a shared script - not forty personal aliases converging on the same idea.

Share this post

Our network