Elena' s AI Blog

Type Less, Do More: My Top 10 Git Aliases

13 Feb 2026 (updated: 17 Jul 2026) / 6 minutes to read

Elena Daehnhardt


High Speed Coding, Midjourney 2026

If you click an affiliate link and subsequently make a purchase, I will earn a small commission at no additional cost (you pay nothing extra). This is important for promoting tools I like and supporting my blogging.

I thoroughly check the affiliated products' functionality and use them myself to ensure high-quality content for my readers. Thank you very much for motivating me to write.



TL;DR:
  • Speed up your workflow by creating Git aliases. Shorten 'git checkout' to 'git co', pretty-print your logs, and create complex shortcuts to save keystrokes every day.

Previous: Part 28 — Git Hooks: The Robot Butler for Your Code

Next: Part 30 — Git Cherry-Pick: The Surgeon's Knife

I am lazy. But usefully lazy.

I believe that if you type the same long command more than three times a day, you should shorten it. Git commands can be verbose, but Git has a built-in aliasing system to fix that.

Git Aliases: Configuration Basics with git config --global alias

Git aliases are shortcuts that map short commands to longer Git functions, defined in your .gitconfig file (usually in your home directory) or set directly from the command line. Aliases created with the --global flag apply across every repository on your machine; aliases created without it apply only to the current repository, stored in that repo’s .git/config file instead.

Here git config --global alias.co checkout allows you to type git co instead of git checkout.

Here are my top essential aliases.

Configuring Basic Git Navigation Aliases (co, br, ci, st)

Run these in your terminal to set them up:

# Basic navigation
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.st status

# Unstaging files (undoing 'git add')
git config --global alias.unstage 'reset HEAD --'

Now, checking status is just git st. It saves milliseconds, but they add up to a feeling of fluidity.

Git Log Alias: Colorized Graph Output with git lg

The default git log output is plain text with no visual branch structure. I use an alias called lg that renders it as a colorized commit graph:

git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"

Try typing git lg after adding this alias. It shows the branch tree, commit hash, relative time (“2 hours ago”), and author name in color. It’s beautiful.

Amending Commits with the Git Oops Alias (commit --amend --no-edit)

Did you commit, but forgot to add a file? Or made a typo in the message? The oops alias wraps Git’s amend command so fixing it takes one word instead of remembering the full flag syntax:

git config --global alias.oops "commit --amend --no-edit"

Now, if you forget something:

  1. git add forgotten_file.py
  2. git oops

The forgotten file gets merged into the last commit like nothing happened, with the original commit message left untouched (that’s what --no-edit does).

Error: git: 'co' is not a git command. See 'git --help'.

This error means Git can’t find the alias in any config file it reads. Common causes and fixes:

  • Typo in the alias name or missing --global flag — verify the alias exists with git config --get alias.co; if it returns nothing, re-run git config --global alias.co checkout.
  • Alias set locally in a different repository — a local alias (set without --global) only works inside that one repo. Check with git config --local --get alias.co, or re-add it globally.
  • Wrong config file being read — confirm which file Git is using with git config --global --list --show-origin, and check that ~/.gitconfig actually contains an [alias] section.

Related tools you may want to try next.

Play.ht can generate voice from text prompts, creates audio embeddings and play buttons for WordPress or any web page, podcast creation, and much more in respect to voice synthesis.

Git Aliases FAQ

How do I list all my configured Git aliases?

Run git config --get-regexp alias to see every alias defined in your Git configuration, both global and local.

Where are Git aliases stored?

Aliases created with git config --global are stored in your global .gitconfig file, usually located in your home directory. Aliases created without --global are stored in the current repository’s .git/config file instead.

Can I remove a Git alias I no longer need?

Yes. Run git config --global --unset alias.<name>, for example git config --global --unset alias.co, to delete a global alias.

Why doesn’t git lg show colors in some terminals?

Some terminals, CI runners, and piped output disable ANSI color codes by default. If git lg prints raw escape sequences instead of colors, check that your terminal supports ANSI colors, or pipe through a tool like less -R to preserve them.

Key Takeaway: Git Aliases Reduce Repetitive Command Typing

Customizing Git aliases is a practice that reflects a developer’s familiarity with their own workflow: it means understanding which commands recur often enough to be worth shortening.

Take a few minutes to configure these aliases. Your fingers will thank you.

For the full command reference, see the official Git config documentation on defining aliases.

Did you like this post? Please let me know if you have any comments or suggestions.

Git posts that might be interesting for you




desktop bg dark

About Elena

Elena, a PhD in Computer Science, simplifies AI concepts and helps you use machine learning.



Citation
Elena Daehnhardt. (2026) 'Type Less, Do More: My Top 10 Git Aliases', daehnhardt.com, 13 February 2026. Available at: https://daehnhardt.com/blog/2026/02/13/git-aliases/
All Posts