Git Aliases: Speed Up Your Daily Workflow
What Are Git Aliases?
Aliases are custom shorthand commands defined in your Git config. Instead of typing git commit --amend every time, you can set git amend and save dozens of keystrokes daily.
Setting Up Aliases
# Basic alias git config --global alias.co checkout git config --global alias.br branch git config --global alias.st status git config --global alias.ci commit
Now you can use:
git co main git br feature-login git st git ci -m "Message"
Advanced Aliases
Aliases can run complex commands:
# Better log with graph git config --global alias.lg "log --oneline --graph --all --decorate" # Show last commit git config --global alias.last "log -1 HEAD" # Undo last commit (keep changes) git config --global alias.undo "reset --soft HEAD~1" # List branches with dates git config --global alias.branches "branch -a -v"
Shell Aliases
Prefix with ! to run shell commands:
git config --global alias.standup "!git log --since=yesterday --oneline --author=$(git config user.name)" git config --global alias.root "!pwd"
Editor Integration
Edit aliases directly:
git config --global --edit # Opens ~/.gitconfig in your editor
Example ~/.gitconfig section:
[alias] co = checkout br = branch st = status ci = commit lg = log --oneline --graph --all --decorate undo = reset --soft HEAD~1
Start Small
Add aliases for commands you use ten times a day. Within a week, muscle memory takes over and you will wonder how you lived without them.
Get the complete offline Git Field Guide
The 97-page PDF + ePub course — ₹499. Read this command, offline.
Related Git Command References
All 28 commands →Syntax breakdowns and practical terminal examples for commands used in this topic
More on Git Fundamentals & Setup
All articles →- Guide
How to Install Git on Windows, macOS, and Linux
A step-by-step setup guide covering every major platform, from Homebrew and Winget to package managers, plus verifying your install and configuring your identity.
Read guide - Guide
How to Write Better Git Commit Messages
A practical guide to writing clear, conventional commit messages that make your project history readable and your team more productive.
Read guide