Skip to content

Instantly share code, notes, and snippets.

@jrbeeman
Created November 1, 2013 22:16
Show Gist options
  • Save jrbeeman/7272862 to your computer and use it in GitHub Desktop.
Save jrbeeman/7272862 to your computer and use it in GitHub Desktop.
My .gitconfig
[core]
excludesfile = /Users/jbeeman/.gitignore_global
editor = subl -n -w
[diff]
tool = vimdiff
memonicprefix = true
[difftool]
prompt = false
[alias]
d = difftool
info = !$HOME/bin/git-info
pager = !$HOME/bin/git-pager
upstream-diff = "!sh -c 'git log $0 --not --remotes=upstream --full-diff --no-merges --pretty=fuller --patch -m --reverse'"
log-branch-short = "!sh -c 'git log $0 --not --remotes=upstream --no-merges --pretty=oneline'"
whatis = show -s --pretty='tformat:%h (%s, %ad)' --date=short
hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=
diff-short = diff --name-status
branch-unmerged = branch -lv --no-merge
branch-unmerged-remote = branch -lrv --no-merge
; Source: https://github.com/durdn/cfg/blob/master/.gitconfig
st = status -s
cl = clone
ci = commit
cm = commit -m
cma = commit -a -m
ca = commit --amend
amend = commit --amend
caa = commit -a --amend -C HEAD
filelog = log -u
fl = log -u
ai = add --interactive
co = checkout
cob = checkout -b
br = branch
#"!git branch -ra | grep -v done"
branch = branch -ra
#list commands
le = log --oneline --decorate
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
ls1 = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate
lds = log --pretty=format:"%C(yellow)%h\\ %C(green)%ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short --graph
ls = log --pretty=format:"%C(green)%h\\ %C(yellow)[%ad]%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative
lc = "!f() { git ll "$1"^.."$1"; }; f"
lnc = log --pretty=format:"%h\\ %s\\ [%cn]"
#list all aliases
la = "!git config -l | grep alias | cut -c 7-"
diff = diff --word-diff
d = diff --word-diff
dc = diff --cached
#list modified files in last commit
dl = "!git ll -1"
#diff last commit
dlc = diff --cached HEAD^
dr = "!f() { git diff -w "$1"^.."$1"; }; f"
diffr = "!f() { git diff "$1"^.."$1"; }; f"
#stash
sl = stash list
sa = stash apply
ss = stash save
# awk from root folder
awk = awk -i
awka = "!f() { A=$(pwd) && TOPLEVEL=$(git rev-parse --show-toplevel) && cd $TOPLEVEL && git awk -i $1 | xargs -I{} echo $TOPLEVEL/{} && cd $A; }; f"
#grep on filename
f = "!git ls-files | grep -i"
#list remotes
remotes = "!git config -l | grep remote.*url | tail -n +2"
#subtree add
sba = "!f() { git subtree add --prefix $2 $1 master --squash; }; f"
# Source: http://stackoverflow.com/questions/1057564/pretty-git-branch-graphs
lg1 = 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
lg2 = 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
lg = !"git lg1"
[color]
ui = true
branch = auto
diff = auto
status = auto
[color "branch"]
current = red reverse
local = blue
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = yellow
changed = green
untracked = cyan
[apply]
whitespace = nowarn
[status]
;relativePaths = false
showUntrackedFiles = all
[instaweb]
local = true
httpd = /Applications/acquia-drupal/apache/bin/httpd
port = 1234
browser = firefox
modulepath = /Applications/acquia-drupal/apache/modules
[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
[merge]
renameLimit = 10000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment