Skip to content

Instantly share code, notes, and snippets.

@melkorm
Last active October 21, 2015 08:29
Show Gist options
  • Save melkorm/ac756ad2ba3e165d41b5 to your computer and use it in GitHub Desktop.
Save melkorm/ac756ad2ba3e165d41b5 to your computer and use it in GitHub Desktop.
Power GIT config
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]"
lds = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short
ld = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative
le = log --oneline --decorate
filelog = log -u
fl = log -u
lasttag = describe --tags --abbrev=0
lt = describe --tags --abbrev=0
ours = "!f() { git co --ours $@ && git add $@; }; f"
theirs = "!f() { git co --theirs $@ && git add $@; }; f"
pull-and-push = "!f() { git pull -r && git push; }; f"
stash-and-pull = "!f() { git stash && git pull -r && git stash pop; }; f"
versions = "!f() { git tag | sort -r -t. -k 1.2,1n -k 2,2n -k 3,3n -k 4,4n; }; f"
phpcs-pre = "!f() { git diff --diff-filter=MC --name-only origin/dev | grep php | xargs ./vendor/bin/phpcs --standard=./phpcs.xml; }; f"
phpcs-post = "!f() { git diff --diff-filter=MC --name-only origin/dev... | grep php | xargs ./vendor/bin/phpcs --standard=./phpcs.xml; }; f"
cp = cherry-pick
st = status -s
cl = clone
ci = commit
co = checkout
br = branch -vv
brr = branch -vv -r
bra = branch -vv -a
diff = diff --word-diff
dc = diff --cached
r = reset
r1 = reset HEAD^
r2 = reset HEAD^^
rh = reset --hard
rh1 = reset HEAD^ --hard
rh2 = reset HEAD^^ --hard
sl = stash list
sa = stash apply
ss = stash save
istracked = ls-files --error-unmatch
smerge = merge --squash
sci = commit -a -m 'squash! commit'
refresh = fetch -p
latest = for-each-ref --sort=-committerdate --format='%(committerdate:short) %(refname:short) [%(committername)]'
lg2 = log --graph --abbrev-commit --decorate --format=tformat:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(red)- %aN%C(reset)%n''%w(100, 15, 15)%b'
lg = !"git lg2"
undo-commit = reset --soft HEAD^
to-release = log --oneline --decorate --merges --first-parent ...master
[push]
default = simple
[core]
editor = vim
excludesfile = /Users/melkorm/.gitignore_global
fileMode = false
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path =
[mergetool "sourcetree"]
cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
trustExitCode = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment