Skip to content

Instantly share code, notes, and snippets.

@Bazze Bazze/.gitconfig
Last active May 4, 2016

Embed
What would you like to do?
My .gitconfig
[color]
ui = auto
[color "branch"]
# good looking colors i copy/pasted from somewhere
current = green bold
local = green
remote = red bold
[color "diff"]
# good looking colors i copy/pasted from somewhere
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
# good looking colors i copy/pasted from somewhere
added = green bold
changed = yellow bold
untracked = red
[color "sh"]
branch = yellow
[alias]
s = status
st = status
ci = commit
br = branch
co = checkout
df = diff
rb = rebase
t = tag --sort version:refname
# If you use shortened hashes, sometimes you may encounter a collision. The following alias prints out all commits whose hash start with given string.
abbr = "!sh -c 'git rev-list --all | grep ^$1 | while read commit; do git --no-pager log -n1 --pretty=format:\"%H %ci %an %s%n\" $commit; done' -"
# Show a nice colored graph view of the commit history
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative
# Takes the name of a person or their email address and returns information about that author
whois = "!sh -c 'git log -i -1 --pretty=\"format:%an <%ae>\n\" --author=\"$1\"' -"
# Show a short summary of a commit
whatis = show -s --pretty='tformat:%h (%s, %ad)' --date=short
# If you've eg. moved around a bunch of lines in data files, and want a diff of what _else_ happened
sortdiff = !sh -c 'git diff "$@" | grep "^[+-]" | sort --key=1.2 | uniq -u -s1'
# You get a lot of merge conflicts and want to quickly solve them using an editor and then add the conflicted files.
edit-unmerged = "!f() { git diff --name-status --diff-filter=U | cut -f2 ; }; nano `f`"
add-unmerged = "!f() { git diff --name-status --diff-filter=U | cut -f2 ; }; git add `f`"
# This produces output that can be displayed using dotty, for example: git graphviz HEAD~100..HEAD~60 | dotty /dev/stdin
graphviz = "!f() { echo 'digraph git {' ; git log --pretty='format: %h -> { %p }' \"$@\" | sed 's/[0-9a-f][0-9a-f]*/\"&\"/g' ; echo '}'; }; f"
[rerere]
enabled = true
[core]
editor = nano
[push]
default = simple
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.