Created
October 10, 2012 10:14
-
-
Save sreeix/3864565 to your computer and use it in GitHub Desktop.
My .gitconfig
This file contains 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
[user] | |
email = [email protected] | |
name = V Sreekanth | |
[color] | |
diff = auto | |
status = auto | |
branch = auto | |
interactive = auto | |
ui = auto | |
[merge] | |
#tool = meld | |
tool = diffuse | |
#tool = diffuse | |
[alias] | |
# shotcuts | |
m = checkout master | |
st = status | |
ci = commit | |
br = branch | |
co = checkout | |
# not a fan of random merges | |
pull = pull --ff-only | |
# because I always typo git commit --ammend, er, amend | |
amend = commit --amend | |
ammend = amend | |
merge-upstream = !"git fetch origin -v; git fetch upstream -v; git merge upstream/master" | |
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 | |
# 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`' -" | |
# 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 | |
# 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 | |
# 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 | |
# 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 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" | |
# 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 | |
# 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 | |
backrupt = 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 | |
# 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';'" | |
# show a specifc version of a file | |
# git show rev:filename | |
[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 | |
[mergetool "diffmerge"] | |
cmd = diffmerge --merge --result=$MERGED $LOCAL $BASE $REMOTE | |
trustExitCode = false | |
[diff] | |
tool = diffuse | |
[core] | |
excludesfile = /Users/v/.gitignore_global | |
[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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment