Skip to content

Instantly share code, notes, and snippets.

@Anticom
Created December 19, 2016 13:31
Show Gist options
  • Save Anticom/27b079c8c1673df004da9f588f4563b9 to your computer and use it in GitHub Desktop.
Save Anticom/27b079c8c1673df004da9f588f4563b9 to your computer and use it in GitHub Desktop.
My git setup
cat ~/.gitconfig
[user]
name = XXXXXXX
email = XXXXXXX@XXXXXX
[github]
user = Anticom
[core]
excludesfile = ~/.gitignore_global
editor = vim
filemode = false
trustctime = false
[branch]
#autosetupmerge = always
#autosetuprebase = always
[color]
ui = auto
interactive = auto
ui = true
pager = true
[color "branch"]
current = yellow bold
local = green bold
remote = cyan bold
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
whitespace = red reverse
[color "status"]
added = green bold
changed = yellow bold
untracked = red bold
[help]
autocorrect = 1
[fetch]
prune = true
[push]
default = simple
[diff]
renames = copies
tool = vimdiff
[difftool]
promt = false
trustExitCode = true
[merge]
#tool = vimdiff
tool = meld
conflictstyle = diff3
[mergetool]
promt = false
trustExitCode = true
[mergetool "meldold"]
cmd = /usr/bin/meld "$LOCAL" "$MERGED" "$REMOTE"
[pager]
#diff = diff-highlight | less
[grep]
lineNumber = true
#[rerere]
# enabled = true
# http://durdn.com/blog/2012/11/22/must-have-git-aliases-advanced-examples/
[alias]
# list aliases:
la = "!git config -l | grep alias | cut -c 7-"
#from pretty (verbose) to less verbose (not all)
lg1 = log --graph --abbrev-commit --decorate --format=format:'%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(dim white)- %an%C(reset)'
lg2 = log --graph --abbrev-commit --decorate --date=relative --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)'
lg3 = log --color --graph --pretty=format:'%C(bold blue)%h%Creset -%C(bold yellow)%d%Creset %s %C(bold green)(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
#from pretty (verbose) to less verbose (all)
lga1 = log --graph --abbrev-commit --decorate --format=format:'%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(dim white)- %an%C(reset)' --all
lga2 = log --graph --abbrev-commit --decorate --date=relative --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)' --all
lga3 = log --color --graph --pretty=format:'%C(bold blue)%h%Creset -%C(bold yellow)%d%Creset %s %C(bold green)(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --all
#default
lg = !"git lg1"
lga = !"git lga1"
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --stat
le = log --oneline --decorate
fl = log -u
#lgr = log --graph --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold yellow)%H%C(reset)%n' --all
# overview
#ov = "!echo $(pwd)"
#ov = "!git ls-tree -r --name-only HEAD | while read filename; do echo \"$(git log -1 --format=\"%ad\" -- $filename) $filename\"; done"
# List some information
# Authors
#al = shortlog -sen
al = !git log --format=format:'%C(bold yellow)<%an>%C(reset) %C(dim bold white)%ae%C(reset) (%C(dim yellow)<%cn>%C(reset) %C(dim white)%ce%C(reset))' | sort | uniq
# Branches (including tracked / untracked remote branches)
bl = branch -avv
# Remotes
rl = remote -v
# Tags
tl = tag -l
diff = diff --word-diff
dbc = difftool
dc = difftool --cached
dlc = difftool --cached HEAD^
ds = diff --cached HEAD^ --stat
dr = "!f() { git diff "$1"^.."$1"; }; f"
lc = "!f() { git ll "$1"^.."$1"; }; f"
f = "!git ls-files | grep -i"
fr = "!git ls-files | grep -iR"
gr = grep -Iin
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"
done = "!f() { git branch | grep "$1" | cut -c 3- | grep -v done | xargs -I{} git branch -m {} done-{}; }; f"
assume = update-index --assume-unchanged
unassume = update-index --no-assume-unchanged
assumed = "!git ls-files -v | grep ^h | cut -c 3-"
unassumeall = "!git assumed | xargs git update-index --no-assume-unchanged"
assumeall = "!git st -s | awk {'print $2'} | xargs git assume"
lt = describe --tags --abbrev=0
ours = "!f() { git co --ours $@ && git add $@; }; f"
theirs = "!f() { git co --theirs $@ && git add $@; }; f"
cp = cherry-pick
st = status -s -b
cl = clone
ci = commit -v
co = checkout
br = branch
r = reset
r1 = reset HEAD^
r2 = reset HEAD^^
rh = reset --hard
rh1 = reset HEAD^ --hard
rh2 = reset HEAD^^ --hard
# currently not needed
#svnr = svn rebase
#svnd = svn dcommit
#svnl = svn log --oneline --show-commit
# stash list, apply, inspect, save
sl = stash list
sa = stash apply
si = stash show -p
ss = stash save
amend = commit --amend --reuse-message=HEAD
contrib = shortlog --summary --numbered
*~
._*
.DS_Store
.idea
node_modules
bower_components
tags
tags.lock
tags.temp
**/eclipse/
**/Release/
**/Debug/
**/MinSizeRel/
**/RelWithDebInfo/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment