Git & Version Controlbeginner
Configure useful git aliases for common workflows
Git Alias Setup
Configure useful git aliases for common workflows
Configure productive git aliases for common workflows.
Instructions
Add these aliases to ~/.gitconfig:
[alias]
# Quick status and log
s = status --short --branch
l = log --oneline --graph --decorate -20
la = log --oneline --graph --decorate --all
# Commit shortcuts
cm = commit -m
ca = commit --amend --no-edit
# Branch management
co = checkout
cb = checkout -b
bd = branch -d
bD = branch -D
# Diff shortcuts
d = diff
ds = diff --staged
dw = diff --word-diff
# Stash shortcuts
ss = stash push -m
sp = stash pop
sl = stash list
# Undo shortcuts
unstage = restore --staged
undo = reset --soft HEAD~1
# Find
find = log --all --full-history --
search = log --all -S
# Cleanup
cleanup = !git branch --merged main | grep -v 'main\|master\|develop' | xargs git branch -d
# Show what I did today
today = log --since='midnight' --oneline --no-merges --author
Usage Examples
git s # short status
git l # pretty log
git cm "fix typo" # quick commit
git cb feature/x # create and switch to branch
git undo # undo last commit, keep changes
git today # what did I commit today