# git aliases for .gitconfig # Add to ~/.gitconfig: # [include] # path = ~/dev/100x/configs/git-aliases.gitconfig [alias] st = status -sb co = checkout cb = checkout -b sw = switch swc = switch -c ci = commit ca = commit --amend --no-edit cm = commit -m d = diff dc = diff --cached dw = diff --word-diff dn = diff --name-only unstage = reset HEAD undo = reset --soft HEAD~1 fp = push --force-with-lease wip = "!git add -A && git commit -m \"WIP: $(date +%H:%M)\"" lg = log --graph --abbrev-commit --decorate --all --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' lol = log --graph --oneline --decorate --all who = shortlog -sn --all today = "!git log --since=midnight --author=\"$(git config user.name)\" --oneline" week = "!git log --since='1 week ago' --author=\"$(git config user.name)\" --oneline --stat" cleanup = "!git branch --merged main | grep -v 'main\\|master\\|\\*' | xargs -r git branch -d" # Find branches containing commit fb = "!f() { git branch -a --contains $1; }; f" # Find commits by message fm = "!f() { git log --all --oneline --grep=$1; }; f" # Contributors (ranked) contrib = shortlog -sn --all --no-merges # Diff stat ds = diff --stat # Last commit last = log -1 HEAD --stat # Remote URL url = config --get remote.origin.url # Assume unchanged (for local config files) assume = update-index --assume-unchanged unassume = update-index --no-assume-unchanged assumed = "!git ls-files -v | grep ^h | cut -c 3-" # Stash all (including untracked) stashall = stash --include-untracked # Diff of last commit dlc = diff HEAD~1..HEAD [rebase] autoSquash = true autoStash = true [rerere] enabled = true [merge] conflictstyle = zdiff3 [pull] rebase = true [push] default = current autoSetupRemote = true followTags = true [fetch] prune = true pruneTags = true