Skip to content

Instantly share code, notes, and snippets.

@rantav
Last active September 1, 2017 22:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rantav/5d6fb14057f062ecbc70 to your computer and use it in GitHub Desktop.
Save rantav/5d6fb14057f062ecbc70 to your computer and use it in GitHub Desktop.
gitconfig
# Many goodies from here and all around http://stackoverflow.com/questions/267761/what-does-your-gitconfig-contain
[user]
name = Your Full Name
email = your@email.com
[github]
user = your-github-username
[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
[alias]
st = status
# diff stats
ds = !git --no-pager diff --stat -M -w
ci = commit
br = branch
co = checkout
w = whatchanged
# Visual Diff tool (Diff all changed files at the same time)
vdiff = !git-diff-all.sh
# show list of contributors in descending order by number of commits
rank = shortlog -sn --no-merges
# given any git object, try to show it briefly
whatis = show -s --pretty='tformat:%h (%s, %ad)' --date=short
# 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 \"$@\""
# Change log in a compact format
changes = log --oneline --reverse
# shows a nice graph of branches/merges
graph = log --graph --pretty=format:'%C(red)%h%C(reset) %C(yellow)%d%C(reset)%s %C(green)%an %C(bold black)%cr%C(reset)' --abbrev-commit --date=relative
# list of tags
tags = tag -n1 -l
# After I accidentally commit too much and want to roll back the commit but keep the changes:
uncommit = reset --soft HEAD^
# Amend last commit's message
amend = commit --amend
# The usual pull command with a --rebase b/c that's how I like it
pl = pull --rebase
unstage = reset
[core]
pager = less -FRSX
whitespace=fix,-indent-with-non-tab,trailing-space,cr-at-eol
[apply]
whitespace = fix
[push]
default = simple
[credential]
helper = osxkeychain
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment