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
π Subscribe to keep reading.
Amending Commits with the Git Oops Alias (commit --amend --no-edit)
π Subscribe to keep reading.
Key Takeaway: Git Aliases Reduce Repetitive Command Typing
π Subscribe to keep reading.
Subscribe to unlock the full article β€οΈ
I keep most of the site completely open. A few unusually detailed tutorials need a free subscriber login so I can keep publishing this kind of work.
Log in to unlock
The form below signs you up for the newsletter. It does not log you into the app β log in afterwards (same email) to unlock this article and download your subscriber gifts. New subscribers get an inbox mail: Set a password to unlock articles.
Full content temporarily unavailable β refresh in a moment