Tips & tricks
Git aliases I use every day
Updated Jul 4, 2026 1 min
These are the git aliases I reach for constantly. Drop them in your ~/.gitconfig under [alias] and they are available as git <name>.
[alias]
st = status -sb
co = checkout
br = branch
ci = commit
lg = log --oneline --graph --decorate -20
last = log -1 HEAD --stat
unstage = reset HEAD --
amend = commit --amend --no-edit
The ones I use most
git stgives a short, branch-aware status instead of the verbose default.git lgis a compact, graphed log of the last 20 commits, which is usually all I want to see.git unstage <file>takes something back out of the index without touching your changes.git amendfolds staged changes into the last commit and keeps the message, which is perfect for a quick fixup before pushing.
A note on amend
Only amend commits you have not pushed yet. Rewriting a commit that is already shared means everyone else has to deal with the history change, which is rarely worth it.