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:
git add forgotten_file.pygit 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
--globalflag — verify the alias exists withgit config --get alias.co; if it returns nothing, re-rungit 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 withgit 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~/.gitconfigactually 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 youEnjoyed this? Get more like it.
Weekly notes on AI tools, Python, and what I'm actually building — plus a free copy of Fantastic AI: The 2026 Toolkit.