7 Git Aliases That Save 1 Hour Every Day

Why Git Aliases Matter
Every developer types hundreds of git commands each day. If each command saves 3-5 seconds, multiplied by frequency, you're looking at hours per week. Git aliases aren't just faster โ they help you think in workflows instead of commands.
Many workflow approaches have been tried, but simple aliases keep winning. Here are 7 essential aliases.
1. git st โ Replace git status
git config --global alias.st "status -sb"
The default git status is verbose. The -sb flags show branch name + file changes in a compact format.
Before and after:
# Before: (many lines, takes up the whole screen)
# After:
M src/app.ts
M src/utils.ts
?? new-file.txt
This is the most-used alias โ every time git st replaces git status -sb, about 20 seconds per day are saved.
2. git cm โ Quick Commit
git config --global alias.cm "commit -m"
Simple but effective. Instead of:
git add . && git commit -m "fix: resolve auth bug"
You type:
git add . && git cm "fix: resolve auth bug"
3. git lg โ Better Log
git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
This is the most complex alias but worth setting up. You get graph visualization of branch history, along with author names and commit times.
git lg
# * a1b2c3d - (HEAD -> main) fix: resolve auth bug (2 hours ago) <Nam>
# * e4f5g6h - feat: add user profile page (5 hours ago) <Nam>
# * i7j8k9l - (origin/main) chore: update dependencies (1 day ago) <Dependabot>
4. git undo โ Undo Last Commit
git config --global alias.undo "reset --soft HEAD~1"
This is the "lifesaver" alias when you commit by mistake or need to amend content. The --soft flag keeps staged changes, only dropping the commit.
Note: Use --hard if you want to discard changes too (โ ๏ธ use carefully).
5. git stash-all โ Stash Everything
git config --global alias.stash-all "stash --include-untracked"
The default git stash only stashes tracked files. If you have new untracked files, they'll be skipped. This alias fixes that.
git stash-all -m "wip: working on feature X"
# Now your working directory is clean
6. git aliases โ List All Aliases
git config --global alias.aliases "config --get-regexp alias"
When you have many aliases and forget what you've configured, this lists everything. Very useful after switching machines or resetting config.
git aliases
# alias.st status -sb
# alias.cm commit -m
# alias.lg log --graph --pretty=format:...
7. git recent โ Quick Recent Log
git config --global alias.recent "log --oneline --graph --decorate -15"
Instead of git log showing dozens of lines, this shows only the 15 most recent commits in compact form. Enough context without information overload.
Bonus: Shell Functions for Git Workflow
Beyond aliases, add these shell functions to ~/.zshrc:
# Quick branch + commit workflow
gac() {
git add -A && git cm "$*"
}
# Usage: gac fix: resolve auth bug
# Checkout new branch from main
gco-new() {
git checkout main && git pull && git checkout -b "$1"
}
# Usage: gco-new feature/user-profile
Quick Setup
Create ~/.gitconfig with:
[alias]
st = status -sb
cm = commit -m
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
undo = reset --soft HEAD~1
stash-all = stash --include-untracked
aliases = config --get-regexp alias
recent = log --oneline --graph --decorate -15
Or use git config --global commands to add aliases one by one.
Conclusion
These 7 aliases are just the starting point. The key is: customize for your workflow. If you frequently need git diff --staged, add an alias for it. If you often merge branches, create a git m alias.
The goal isn't to type less โ it's to reduce cognitive load, so your brain focuses on code instead of remembering git commands.
What aliases do you use? Share in the comments!
Related Posts
Zoom-in: Git Worktree
git worktree โ Git's hidden superpower for multitasking. Understand how Git coordinates flat .git text files, worktree metadata, and commondir to support parallel branches without cloning.
ZCode Secretly Uploads Your Entire Git History to the Cloud
Zhipu's ZCode packages your .git history, encrypts it, and uploads it to Aliyun OSS โ with a key only the server can use.
Zoom-in: Git Commit
git commit -m 'fix bug' โ one command. Under the hood is an immutable, content-addressed data structure that explains why rebase, cherry-pick, and merge work the way they do.