Skip to content

Instantly share code, notes, and snippets.

@hamstu
Created April 3, 2024 15:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hamstu/f475c738575a48b34bf9ec9936de981f to your computer and use it in GitHub Desktop.
Save hamstu/f475c738575a48b34bf9ec9936de981f to your computer and use it in GitHub Desktop.
.gitconfig
[alias]
branch-cleanup = "!git branch --merged | egrep -v \"(^\\*|master|dev)\" | xargs git branch -d #"
ca = !git add -A && git commit -av
s = status -s
l = log --pretty=oneline -n 20 --graph --abbrev-commit
ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
la = "!git config -l | grep alias | cut -c 7-"
ca = !git add -A && git commit -av
co = checkout
cob = checkout -b
# list branches sorted by last modified
b = "!git for-each-ref --sort='-authordate' --format='%(authordate)%09%(objectname:short)%09%(refname)' refs/heads | sed -e 's-refs/heads/--'"
branch-name = "!git rev-parse --abbrev-ref HEAD"
publish = "!git push -u origin $(git branch-name)"
nevermind = !git reset --hard HEAD && git clean -d -f
restore = !git checkout $(git rev-list -n 1 HEAD -- \"$1\")^ -- \"$1\"
conflicts = !git diff --name-only --diff-filter=U
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment