Skip to content

Instantly share code, notes, and snippets.

@LeandroBarral
Last active June 20, 2021 17:08
Show Gist options
  • Save LeandroBarral/b4a06401bd7413300e68 to your computer and use it in GitHub Desktop.
Save LeandroBarral/b4a06401bd7413300e68 to your computer and use it in GitHub Desktop.
gitconfig
[alias]
sts = status -s
st = !git fetch && git status
cm = commit
co = checkout
am = commit --amend --no-edit
w = whatchanged
ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%C(62)\\ [%cn]\\ %ce" --decorate
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%C(62)\\ [%cn]\\ %ce" --decorate --numstat
cls = clean -xdf
local-branches = !git branch -vv | cut -c 3- | awk '$3 !~/\\[/ { print $1 }'
alias = "!sh -c '[ $# = 2 ] && git config --global alias.\"$1\" \"$2\" && exit 0 || echo \"usage: git alias <new alias> <original command>\" >&2 && exit 1' -"
boom = reset --hard
mt = mergetool
b = "!f() { git checkout -b $1; git push -u origin $1; }; f"
db = "!f() { git push origin :$1; git branch -D $1; }; f"
dbco = "!sh -c '[ $# = 2 ] && git push origin :$1 && git checkout $2 && git branch -D $1 && exit 0 || echo \"usage: git dbco <branchNameToDelete> <branchToCheckoutAfterDelete>\" >&2 && exit 1' -"
bo = "!f() { git for-each-ref --format='%(color:cyan)%(authordate:format:%m/%d/%Y %I:%M %p) %(align:25,left)%(color:yellow)%(authorname)%(end) %(color:reset)%(refname:strip=3)' --sort=authordate refs/remotes; }; f"
bp = "!f() { git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -d; }; f"
pushall = !git remote | xargs -L1 git push --all
[color]
diff = auto
interactive = auto
status = auto
ui = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment