Created
July 30, 2015 12:43
-
-
Save melwil/4c1259b0d5b9e9faca24 to your computer and use it in GitHub Desktop.
git aliases
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
# Shorthand aliases | |
cp = cherry-pick | |
st = status -s | |
cl = clone | |
ci = commit | |
co = checkout | |
br = branch | |
diff = diff --word-diff | |
dc = diff --cached | |
# Reset commands | |
r = reset | |
r1 = reset --soft HEAD^ | |
# Log | |
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 | |
lnc = log --pretty=format:"%h\\ %s\\ [%cn]" | |
ld = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative | |
lds = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short | |
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative | |
# Diff | |
dl = "!git ll -1" | |
# Find | |
f = "!git ls-files | grep -i" | |
gra = "!f() { A=$(pwd) && TOPLEVEL=$(git rev-parse --show-toplevel) && cd $TOPLEVEL && git grep --full-name -In $1 | xargs -I{} echo $TOPLEVEL/{} && cd $A; }; f" | |
# List aliases | |
la = "!git config -l | grep alias | cut -c 7-" | |
finda = "!grepalias() { git config --global --get-regexp alias | grep -i \"$1\" | awk -v nr=2 '{sub(/^alias\\./,\"\")};{printf \"\\033[31m%_10s\\033[1;37m\", $1};{sep=FS};{for (x=nr; x<=NF; x++) {printf \"%s%s\", sep, $x; }; print \"\\033[0;39m\"}'; }; grepalias" | |
# Clean all the things | |
cl = !git branch --merged | grep -Ev '^\\s*(\\*|dev|master|stag)' | xargs -n 1 git branch -d && git remote update --prune |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment