Created
June 10, 2014 07:23
-
-
Save dynamicguy/5d66987b0c6e073ea39f to your computer and use it in GitHub Desktop.
~/.gitconfig
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# local user config, usernames, etc | |
[core] | |
excludesfile=~/.gitignore | |
[include] | |
path=~/.gitconfig-local | |
[color] | |
diff = auto | |
status = auto | |
branch = auto | |
interactive = auto | |
ui = auto | |
[merge] | |
#tool = meld | |
tool = diffuse | |
[status] | |
relativePaths = true | |
showUntrackedFiles = no | |
[diff] | |
tool = diffuse | |
suppressBlankEmpty = true | |
mnemonicprefix = true | |
#noprefix = true | |
# convert po files to a less noisy | |
# # variant for display in git log -p etc | |
# # note that textconv does not affect | |
# # git-format-patch output | |
[diff "po"] | |
textconv=po_diff | |
cachetextconv = true | |
[diff "pot"] | |
textconv=pot_diff | |
# the line's it was picking for the "funcname" | |
# context were kind of terrible for this case, so | |
# just match a blank line so it's empty | |
xfuncname = "^$" | |
cachetextconv = true | |
# from http://stackoverflow.com/questions/2006351/gettext-po-files-under-version-control/11291001#11291001 | |
# more verbose than my minimal version | |
[diff "msgcat"] | |
textconv=msgcat --no-location --no-wrap --sort-output | |
# | |
# custom python xfuncname from | |
# https://github.com/cofi/dotfiles/blob/master/gitconfig | |
#[diff "python"] | |
# xfuncname="^\\s*(class.*\\(.*\\)|def.*)(\\(|:)" | |
[mergetool "vimdiff3"] | |
cmd = vim -f -d -c \"wincmd J\" \"$MERGED\" \"$LOCAL\" \"$BASE\" \"$REMOTE\" | |
[difftool "vim"] | |
cmd = vim \"$MERGED\" | |
prompt = false | |
[push] | |
default = tracking | |
[branch] | |
autosetupmerge = true | |
[color "branch"] | |
current = yellow reverse | |
local = yellow | |
remote = green | |
[color "diff"] | |
meta = yellow bold | |
frag = magenta | |
plain = white bold | |
old = red bold | |
new = green bold | |
commit = yellow bold | |
func = green dim | |
#plain = white bold | |
[color "status"] | |
added = yellow | |
changed = green | |
untracked = cyan | |
[alias] | |
l = log --no-merges | |
# shotcuts | |
m = checkout master | |
# not a fan of random merges | |
pull = pull --ff-only | |
# because I always typo git commit --ammend, er, amend | |
amend = commit --amend | |
ammend = amend | |
send-note = send-email --annotate | |
# various pretty loggers from various places | |
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative | |
lc = log ORIG_HEAD.. --stat --no-merges | |
# from http://blog.kfish.org/2010/04/git-lola.html | |
lol = log --graph --decorate --pretty=oneline --abbrev-commit | |
lola = log --graph --decorate --pretty=oneline --abbrev-commit --all | |
ll = log --graph --date=short | |
# from https://git.wiki.kernel.org/index.php/Aliases | |
whois = "!sh -c 'git log -i -1 --pretty=\"format:%an <%ae>\n\" --author=\"$1\"' -" | |
whatis = show -s --pretty='tformat:%h (%s, %ad)' --date=short | |
# ignore po files in "git log", sorry translators ;-< | |
slog = "!sh -c 'git log --no-merges $1 `ls | grep -v ^po`' -" | |
# typo | |
rbanch = branch | |
# commits not pushed to $1 | |
unpushed = cherry -v | |
# what tag contains the sha | |
whatrelease = name-rev --name-only | |
# what branch contains the sha | |
contains = branch --contains | |
#from http://serverfault.com/questions/175052/how-to-tell-which-local-branch-is-tracking-which-remote-branch-in-git | |
upstream = rev-parse --symbolic-full-name --abbrev-ref HEAD@{upstream} | |
#also from http://serverfault.com/questions/175052/how-to-tell-which-local-branch-is-tracking-which-remote-branch-in-git | |
tbranch = branch -vv | |
# what got pushed to master in the last hour | |
# based on http://stackoverflow.com/questions/3357219/expose-the-date-a-commit-was-pushed-to-a-repository | |
justpushed = log origin/master@{\"1 hour ago\"}..origin/master -- | |
# log everything with $1 string in the diff | |
timegrep = log -S | |
# like above, but show the diff | |
diffgrep = log -p -S | |
# search logs for a bugzilla like number | |
findbug = "!sh -c 'git log --grep=^$1:' -" | |
# show what tag/release a bug was part of | |
bugrelease = "!sh -c 'git name-rev --tags --name-only $(git log --grep ^$1: --pretty=\"format:%H\n\")' -" | |
# from https://gist.github.com/492227 | |
lost = !"git fsck | awk '/dangling commit/ {print $3}' | git show --format='SHA1: %C(yellow)%h%Creset %f' --stdin | awk '/SHA1/ {sub(\"SHA1: \", \"\"); print}'" | |
# show a log without the formating, occasionaly handy for c&p | |
rawlog = log --format=\"format:commit %H%nAuthor:%an%n%n%B%n\" | |
# show a list of branches sorted by time of last commit | |
brage = "!f() { git for-each-ref --sort=committerdate refs/heads $1 --format=\"%(refname:short)\" ; }; g() { for C in $(f $1) ; do git show -s --pretty=format:\"%Cgreen%ci %Cblue%cr%Creset $C\" \"$C\" -- ; done; }; g " | |
# show remote branches as well | |
brageall = !git brage refs/remotes | |
tbrage = "!f() { git for-each-ref --sort=committerdate refs/heads $1 --format=\"%(refname:short)\" ; }; g() { for C in $(f $1) ; do UP="$(git rev-parse --symbolic-full-name --abbrev-ref $C@{upstream} 2> /dev/null)"; TRACKING=$?; UP=\""-> $UP \""; if [ $TRACKING -ne 0 ] ; then UP=\"\"; fi; git show -s --pretty=format:\"%Cgreen%ci %Cblue%cr%Creset $C $UP\" \"$C\" -- ; done; }; g " | |
tbrageall = !git tbrage refs/remotes | |
# show a list of tags sorted by when they were tagged | |
tagage = "!sh -c 'git for-each-ref --sort=taggerdate refs/tags --format=\"%(refname:short)\"'" | |
# show a list of every branch and show their latests commit, sorted by last commit | |
brlog = "!sh -c 'for C in $(git for-each-ref --sort=committerdate refs/heads --format=\"%(refname:short)\") ; do git show -s --pretty=format:\"%Cgreen%ci %Cblue%cr%Creset $C\" \"$C\" -- ; git show --stat -s $C ; echo; done'" | |
# show a list of last change in each branch of a given path | |
# roly poly fileheads | |
fileheads = "!sh -c 'for C in $(git for-each-ref --sort=committerdate refs/heads --format=\"%(refname:short)\"| tac) ; do git show -s --pretty=format:\"%Cgreen%ci %Cblue%cr%Creset $C\" \"$C\" -- ; git --no-pager log -p -1 $C -- $0; echo; done'" | |
# not useful itself, but handy to remember for use in scripts | |
thisbranch = rev-parse --abbrev-ref HEAD | |
# remove a file from index | |
unadd = git reset HEAD | |
# url of origin, about 99% of what I use git config --list for | |
cloneurl = config --get remote.origin.url | |
# needs python-bugzilla, and git-showbugs | |
openbugs = showbugs -s NEW,ASSIGNED,NEEDINFO,FAILS_QA,REOPENED,ON_DEV | |
closedbugs = showbugs -s PASSES_QA,VERIFIED,RELEASE_PENDING,CLOSED | |
# show a list of files with bug fixes in them, sorted by popularity of occurance | |
# aka, list the buggy files | |
# FIXME: should probably make all the bug regex stuff scripts so it's easier to customize | |
buggyfiles = !"git log -M -C --format=\"format:%n\" --grep=\"^[[:digit:]]\\+:\" --name-only | grep . | sort | uniq -c | sort -n" | |
# from https://github.com/cypher/dotfiles/blob/master/gitconfig | |
ls-ignored = ls-files --exclude-standard --ignored --others | |
# based on "buggyfiles" above and https://github.com/cypher/dotfiles/blob/master/bin/git-churn | |
churn = !"git log -M -C --name-only --format=\"format:%n\" | grep . | sort | uniq -c | sort -n" | |
# branches that are merged locally already, note this includes master itself | |
lurkers = branch --merged master | |
# as per https://twitter.com/jrbowes/status/304942580133679105 | |
# delete all local branches that have been merged into master | |
# | |
# note, "git branch --merged master" will helpfully include master itself | |
# as a branch that has been fully merged to master. Gee, thanks git. | |
# | |
# So for sanity, filter out current branch and anything named master | |
# | |
# Also note -d won't delete branches that aren't merged to their tracking | |
# branch. Use -D if you dont care. | |
# | |
# See also 'git remote prune | |
purge = !"git branch -d $(git branch --merged master | grep -v -e '*' -e 'master')" | |
# mostly from http://stackoverflow.com/questions/67699/how-do-i-clone-all-remote-branches-with-git | |
#binge = "!sh -c 'for BRANCH in $(git branch -a | sed -n \"\=/HEAD$=d; \=/master$=d;s= remotes/==p\") ; do branch --track ${BRANCH##*/} $BRANCH ; done' " | |
# uh, don't do this. list authors by numbers of commits. probably needs a .mailmap | |
churners = shortlog -sn -- | |
# this does the same thing, except slower... | |
#churners = !"git log -M -C --no-color --format=\"%aN\" | sort | uniq -c | sort -n" | |
# burners: who last touched the most code according to annotate see git-burners | |
# alias implementation just for reference | |
#burners = "!f() { for i in $(git ls-files) ; do git annotate -e $i ; done }; g() { f | awk '{print $2 }' | perl -pe 's/\\(\\<(.+@.+)\\>/\\1/' ; }; g" | |
# | |
# yeah, don't do this either. list authors by # of bug id's fixed | |
# I suppose the really mad could make "breakers" that figures out who commits code | |
# that breaks. I can save you the time, it was me. I broke it. | |
fixers = !"git log -M -C --format=\"format:%aN\" --grep=\"^[[:digit:]]\\+:\" | sort | uniq -c | sort -n" | |
# who reverts the most. Totally useless, but I like the name | |
poppers = !"git log -M -C --format=\"format:%aN\" --grep \"Revert\" | sort | uniq -c | sort -n" | |
# shorter alias | |
lsg = ls-github | |
# show which python classes have had the most commits | |
# external script | |
#buggyclasses = "!f() { git log -M -C -p | pcregrep -o \"@@.*@@\\sclass\\s(.*)\\(.*\\)\" | cut -f5 -d\'@\' | sort | uniq -c | sort -n;}; f" | |
# ignore local changes to a file | |
ignore = update-index --assume-unchanged | |
# http://sandofsky.com/blog/git-workflow.html | |
# merge code but not history to manually recommit | |
# for emergency use only | |
bankrupt = merge --squash | |
# https://github.com/wadey/dotfiles/blob/master/gitconfig | |
# check if a branch has been merged into the current HEAD | |
# if on master, "git merged topic" will tell you if topic | |
# has been merged | |
merged = !sh -c 'git rev-list HEAD | grep $(git rev-parse $0)' | |
# https://github.com/prabirshrestha/ProfilesAndSettings/blob/master/.gitconfig | |
# show tags and any tag annotation (tito adds tag annotations for example) | |
tags = tag -n1 -l | |
# https://github.com/aspiers/git-config/blob/master/bin/git-cdup | |
# could be useful for scripts | |
cdup = rev-parse --show-cdup | |
up = !git fetch origin && git rebase origin/master | |
# https://github.com/SixArm/sixarm_git_gitconfig/blob/master/gitconfig-alias.txt | |
# Show the date of the first commit | |
log-first-date = !"git log --date-order --date=iso --pretty=\"format:%ad\" --reverse | head -1" | |
# https://github.com/SixArm/sixarm_git_gitconfig/blob/master/gitconfig-alias.txt | |
# Editing and adding conflicted files: when we get many merge conflicts | |
# and want to quickly solve them using an editor, then add the files. | |
edit-unmerged = "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; $EDITOR `f`" | |
add-unmerged = "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; git add `f`" | |
# from https://github.com/SixArm/sixarm_git_gitconfig/blob/master/gitconfig-alias.txt | |
# Thanks to jtolds on stackoverflow | |
remote-ref = "!bash -c ' \ | |
local_ref=$(git symbolic-ref HEAD); \ | |
local_name=${local_ref##refs/heads/}; \ | |
remote=$(git config branch.\"#local_name\".remote || echo origin); \ | |
remote_ref=$(git config branch.\"$local_name\".merge); \ | |
remote_name=${remote_ref##refs/heads/}; \ | |
echo remotes/$remote/$remote_name'" | |
# also from https://github.com/SixArm/sixarm_git_gitconfig/blob/master/gitconfig-alias.txt | |
# Thanks to jtolds on stackoverflow | |
rebase-recent = !git rebase -i $(git remote-ref) | |
# from http://blog.blindgaenger.net/advanced_git_aliases.html | |
alias = !git config --list | grep 'alias\\.' | sed 's/alias\\.\\([^=]*\\)=\\(.*\\)/\\1\\ = \\2/' | sort | |
# http://superuser.com/a/169696 | |
# prettier than my version of this | |
# doesn't really work, should probably use git for-each-ref | |
#heads = !"git log origin/master.. --format='%Cred%h%Creset;%C(yellow)%an%Creset;%H;%Cblue%f%Creset' | git name-rev --stdin --always --name-only | column -t -s';'" | |
pconfig = config -f .git/config | |
# show a specifc version of a file | |
# git show rev:filename | |
# GIT_TRACE=true to turn on more debugging | |
# GIT_SSH for debug ssh stuff (needs to point to | |
# a wrapper script to add args, aka "ssh -v $*" in a shell script) | |
[achievement] | |
upload = true | |
[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 | |
[filter "media"] | |
clean = git-media-clean %f | |
smudge = git-media-smudge %f |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment