Git Aliases Cheatsheet
Revision History
No revision history recorded yet.
[alias]
# Short status
st = status -sb
# One-line log with graph
lg = log --oneline --graph --decorate --all
# Stage all changes
aa = add --all
# Amend without changing message
fixup = commit --amend --no-edit
# Undo last commit (keep changes staged)
undo = reset --soft HEAD~1
# Show branches sorted by recency
recent = branch --sort=-committerdate --format='%(committerdate:short) %(refname:short)'
# Stash with a message
save = stash push -m
# Delete merged local branches
cleanup = "!git branch --merged | grep -v main | grep -v master | xargs git branch -d"
# Show diff of staged changes
staged = diff --cached