Skip to content

Instantly share code, notes, and snippets.

@th3hunt
Created October 16, 2015 07:53
Show Gist options
  • Save th3hunt/ac8f27714ffc603c2939 to your computer and use it in GitHub Desktop.
Save th3hunt/ac8f27714ffc603c2939 to your computer and use it in GitHub Desktop.
My new gitconfig
[alias]
co = checkout
go = checkout -b
st = status
pr = pull --rebase
br = branch
filediff = diff --name-only
last = log -1 HEAD
fixup = commit --fixup
# Show the diff between the latest commit and the current state
d = !"git diff-index --quiet HEAD -- || clear; git diff --patch-with-stat"
# `git di $number` shows the diff between the state `$number` revisions ago and the current state
di = !"d() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear; d"
# Log display from screencast, with train tracks.
l = log --graph --pretty=format':%C(yellow)%h%Cblue%d%Creset %s %C(white) %an, %ar%Creset'
lg = log --graph --pretty=format:'%Cred%h%Creset %an: %s - %Creset %C(yellow)%d%Creset %Cgreen(%cr)%Creset' --abbrev-commit --date=relative
# Alternate log display from Scott Chacon
lg2 = log --pretty=oneline --abbrev-commit --graph --decorate
# Include all branches
lol = log --pretty=oneline --graph --all --decorate
# Other useful aliases:
merge-ignore-space = merge -Xignore-all-space
unstage = reset HEAD --
staged = diff --cached
unstaged = diff
current-branch = !git symbolic-ref -q HEAD | sed -e 's|^refs/heads/||'
track = checkout -t # Usage: git track origin/feature-123-login-form
unmerged = branch --no-merged
merged = branch --merged
since = !git rev-list $1.. --count # Usage: git since master
count = shortlog -sn
# Show verbose output about tags, branches or remotes
tags = tag -l
branches = branch -a
remotes = remote -v
[color]
diff = auto
status = auto
branch = auto
ui = always
[help]
autocorrect = 1
[status]
submodule = 1
[core]
excludesfile = /Users/stratos/.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