Skip to content

Instantly share code, notes, and snippets.

@lavoiesl
Created October 10, 2012 11:02
gitconfig
# http://blog.lavoie.sl/2012/10/git-tutorial-and-global-configs.html
[user]
name = Sébastien Lavoie
email = github@lavoie.sl
[color]
diff = auto
status = auto
branch = auto
interactive = auto
ui = true
pager = true
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = yellow
changed = green
untracked = cyan
[core]
editor = vi
pager = less -FRSX
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol,space-before-tab
excludesfile = /etc/gitignore
[apply]
whitespace = fix
[alias]
st = status
ci = commit
br = branch
co = checkout
d = diff
dc = diff --cached
dn = diff --name-status
lg = log -p
who = shortlog -s --
w = whatchanged
# Branch, push, set upstream
brp = "!sh -c '[ $# = 1 ] && git checkout -b \"$1\" && git push -u origin \"$1\" || echo \"usage: git brp <new branch>\" >&2 && exit 1' -"
lg = log --graph --pretty=format:'%Cred%h %C(yellow)%d %C(bold blue)<%an> %Cgreen(%cr) %n %Creset %s' --abbrev-commit --date=relative
tree = "log --pretty=format:'%H%d: %s%n %ad %n %an (%ae)' --graph"
forest = "log --pretty=format:'%H%d: %s%n %ad %n %an (%ae)' --graph --all"
aliases = !git config --get-regexp 'alias.*' | colrm 1 6 | sed 's/[ ]/ = /'
alias = "!sh -c '[ $ # = 2 ] && git config --global alias.\"$1\" \"$2\" && exit 0 || echo \"usage: git alias <new alias> <original command>\" >&2 && exit 1' -"
pp = !git pull && git push
root = rev-parse --show-toplevel
# Show files ignored by git:
ign = ls-files -o -i --exclude-standard
graphviz = "!f() { echo 'digraph git {' ; git log --pretty='format: %h -> { %p }' \"$@\" | sed 's/[0-9a-f][0-9a-f]*/\"&\"/g' ; echo '}'; }; f"
# show list of contributors in descending order by number of commits
rank = shortlog -sn --no-merges
# Search for a given string in all patches and print commit messages
# example: search for any commit that adds or removes string "foobar"
# git searchcommits foobar
# example: search commits for string "foobar" in directory src/lib
# git searchcommits foobar src/lib
# example: search commits for "foobar", print full diff of commit with 1 line context
# git searchcommits foobar --pickaxe-all -U1 src/lib
searchcommits = "!f() { query=\"$1\"; shift; git log -S\"$query\" \"$@\"; }; f \"$@\""
# http://twobitlabs.com/2011/08/install-diffmerge-git-mac-os-x/
[merge]
tool = diffmerge
[mergetool "diffmerge"]
cmd = "diffmerge --merge --result=\"$MERGED\" \"$LOCAL\" \"$(if test -f \"$BASE\"; then echo \"$BASE\"; else echo \"$LOCAL\"; fi)\" \"$REMOTE\""
trustExitCode = true
[diff]
tool = diffmerge
[difftool "diffmerge"]
cmd = diffmerge \"$LOCAL\" \"$REMOTE\"
# http://stevenharman.net/git-pull-with-automatic-rebase
[branch]
autosetuprebase = always
# http://pivotallabs.com/users/alex/blog/articles/883-git-config-push-default-matching
[push]
default = matching
[mergetool]
keepBackup = false
# Temp and swap files
*~
*.swp
*.tmp
# Compiled source
*.com
*.class
*.dll
*.exe
*.o
*.so
# OS generated files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
Icon?
ehthumbs.db
Thumbs.db
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment