Skip to content

Instantly share code, notes, and snippets.

@justinrainbow
Created September 6, 2013 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinrainbow/6465359 to your computer and use it in GitHub Desktop.
Save justinrainbow/6465359 to your computer and use it in GitHub Desktop.
My ~/.gitconfig
[apply]
whitespace = nowarn
[alias]
co = checkout
stage = add
unstage = reset HEAD
plog = log --pretty=format:\"%h %Cblue%cr%Creset %cn %Cgreen%s%Creset\"
st = status
ci = commit
w = whatchanged
nm = branch --no-merged
# add all changed (but not new) files to stage (index):
au = add -u
# show list of contributors in descending order by number of commits
rank = shortlog -sn --no-merges
# `git remote prune origin`: remove remote-tracking branches that were deleted from the remote repo
# `git gc`: cleanup unnecessary files and optimize the local repository
# `git clean -df`: remove untracked files and directories from the working tree
# `git stash clear`: remove all stashed states
trim = !git remote prune origin && git gc
# Stash, pull --rebase, unstash
sup = "!f() { git stash && git pull --rebase && git stash pop; }; f"
# change previous commit
amend = commit --amend
graph = log --graph --pretty=oneline --abbrev-commit
hist = log --graph --date-order -C -M --pretty=format:'<%h> %ad [%an] %Cgreen%d%Creset %s' --all --date=short
# This fires up a git daemon for the repo you are currently in:
serve = daemon --reuseaddr --verbose --base-path=. --export-all ./.git
# Use graphviz for display
graphviz = "!f() { echo 'digraph git {' ; git log --pretty='format: %h -> { %p }' \"$@\" | sed 's/[0-9a-f][0-9a-f]*/\"&\"/g' ; echo '}'; }; f"
last = log -1 HEAD
cleanup = "!f() { git status | awk '{print $NF}' | grep .orig; }; f"
# thanks to http://stackoverflow.com/questions/1593051/how-to-programmatically-determine-the-current-checked-out-git-branch
b = !"git symbolic-ref -q HEAD | sed 's#refs/heads/##'"
# up = "!f() { git pull origin $(git symbolic-ref -q HEAD | sed 's#refs/heads/##'); git submodule sync; git submodule update --init; }; f"
up = pull --rebase
dtag = !git tag -a release-`date "+%Y%m%d%H%M"`
testtag = !git tag -a release-`date "+%Y%m%d%H%M"`-test
invoice = log --pretty=format:'%ad - %s' --abbrev-commit --date=short
# Diff what is staged for the next commit
diffc = diff --cached
# Diff overview
diffst = diff --stat
deploy = "!f() { if [ \"\" == \"$2\" ]; then git dtag -m \"\"; else git dtag $@; fi; git push origin --tags master; }; f"
prune-merged = "!f() { git branch -a --merged | grep origin/feature | awk -F '/' '{ print $3 "/" $4 }' | xargs -I {} git push origin :{} }; f;"
contains = !sh -c 'git branch -a --contains $1' -
# Use `origin` as the default remote on the `master` branch in all cases
[branch "master"]
remote = origin
merge = refs/heads/master
# Use `origin` as the default remote on the `develop` branch in all cases
[branch "develop"]
remote = origin
merge = refs/heads/develop
[color]
ui = auto
[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]
sharedRepository = true
autocrlf = input
whitespace = trailing-space
# Use custom `.gitignore` and `.gitattributes`
excludesfile = /opt/boxen/config/git/gitignore
attributesfile = ~/.gitattributes
[url "git@github.com:"]
insteadOf = "gh:"
pushInsteadOf = "github:"
pushInsteadOf = "git://github.com/"
pushInsteadOf = "https://github.com/"
[url "git://github.com/"]
insteadOf = "github:"
[url "git@gist.github.com:"]
insteadOf = "gst:"
pushInsteadOf = "gist:"
pushInsteadOf = "git://gist.github.com/"
[url "git://gist.github.com/"]
insteadOf = "gist:"
[diff]
tool = Kaleidoscope
[difftool]
prompt = false
[difftool "Kaleidoscope"]
cmd = ksdiff --partial-changeset --relative-path \"$MERGED\" -- \"$LOCAL\" \"$REMOTE\"
[merge]
tool = Kaleidoscope
# Include summaries of merged commits in newly created merge commit messages
log = true
[mergetool]
prompt = false
[mergetool "theirs"]
cmd = git merge-file --theirs \"$CURRENT\" \"$BASE\" \"$OTHER\"
[mergetool "sourcetree"]
cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
trustExitCode = true
[mergetool "Kaleidoscope"]
cmd = ksdiff --merge --output \"$MERGED\" --base \"$BASE\" -- \"$LOCAL\" --snapshot \"$REMOTE\" --snapshot
trustExitCode = true
[push]
default = tracking
[init]
templatedir = ~/.git_template
[hub]
protocol = https
[credential]
helper = /opt/boxen/bin/boxen-git-credential
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment