Skip to content

Instantly share code, notes, and snippets.

@gfoster
Created May 17, 2016 17:34
Show Gist options
  • Save gfoster/3c306f4d3f08e26d5f0cfeffbcb74da8 to your computer and use it in GitHub Desktop.
Save gfoster/3c306f4d3f08e26d5f0cfeffbcb74da8 to your computer and use it in GitHub Desktop.
[alias]
unstage = reset
# pull request manipulation
pr = !git pull-request
preq = "!f() { git fetch -fu ${2:-origin} refs/pull/$1/head:pr/$1 && git checkout pr/$1; }; f"
# 'add all' stages all new+changed+deleted files
aa = !git ls-files -d | xargs git rm && git ls-files -m -o --exclude-standard | xargs git add
# 'add grep' stages all new+changed that match $1
ag = "!sh -c 'git ls-files -m -o --exclude-standard | grep $1 | xargs git add' -"
# 'checkout grep' checkouts any files that match $1
cg = "!sh -c 'git ls-files -m | grep $1 | xargs git checkout' -"
# 'diff grep' diffs any files that match $1
dg = "!sh -c 'git ls-files -m | grep $1 | xargs git diff' -"
# 'patch grep' diff --cached any files that match $1
pg = "!sh -c 'git ls-files -m | grep $1 | xargs git diff --cached' -"
# 'remove grep' remove any files that match $1
rmg = "!sh -c 'git ls-files -d | grep $1 | xargs git rm' -"
# 'reset grep' reset any files that match $1
rsg = "!sh -c 'git ls-files -c --with-tree=HEAD | grep $1 | xargs git reset HEAD -- ' -"
p = !git push || /bin/echo \"\n\n** HEY DUMMY YOUR PUSH FAILED **\n\n\"
nuke = !git clean -f -f -d -n && echo "use git nuke-it-bitch if you are sure you want to execute this"
nuke-it-bitch = clean -f -f -d
subup = !git submodule sync && git submodule update --init
wtf = !git-wtf
sub = submodule
cl = clone --recursive
st = status
stat = status -sb
sb = show-branch
ci = commit
co = checkout
ch = checkout
chekcout = checkout
br = branch
df = diff
dt = difftool -y
last = log -1
lg = log -p
rev = rev-parse HEAD
wc = whatchanged --stat
wd = diff --word-diff
up = remote -v update -p
sub = submodule
remotes = remote -v show
up = remote -v update -p
m = !read B RB <<<$(git branch -vv | ruby -ne 'puts $_.match(%r<\\* ([^\\s]+)\\s+\\w+\\s+\\[([^:\\]]+)>)[1,2] * \" \" rescue nil') && git merge $RB
d = !read B RB <<<$(git branch -vv | ruby -ne 'puts $_.match(%r<\\* ([^\\s]+)\\s+\\w+\\s+\\[([^:\\]]+)>)[1,2] * \" \" rescue nil') && git wc ^$B $RB
rd = !read B RB <<<$(git branch -vv | ruby -ne 'puts $_.match(%r<\\* ([^\\s]+)\\s+\\w+\\s+\\[([^:\\]]+)>)[1,2] * \" \" rescue nil') && git wc ^$RB $B
human = name-rev --name-only --refs=refs/heads/*
humin = name-rev --name-only --refs=refs/heads/* --stdin
graphviz = "!f() { echo 'digraph git {' ; git log --pretty='format: %h -> { %p }' \"$@\" | sed 's/[0-9a-f][0-9a-f]*/\"&\"/g' ; echo '}'; }; f"
amend = !git commit --amend -m \"`git log -1| tail -n +5 | perl -pi -e 's/\\W+//'`\"
pp = !git pull && git push
[color]
ui = true
diff = auto
status = auto
branch = auto
interactive = auto
current = yellow reverse
local = yellow
remote = green
[color "diff"]
whitespace = red reverse
frag = cyan
old = red bold
new = green bold
[color "status"]
added = green
changed = yellow
untracked = red
[color "grep"]
match = cyan
filename = yellow
[core]
excludesfile = /Users/gfoster/.gitignore_global
whitespace=trailing-space,cr-at-eol
editor = emacsclient +1 -q -a aquamacs
[apply]
whitespace = nowarn
[push]
default = tracking
[branch]
autosetupmerge = true
[merge]
stat = true
conflictstyle = diff3
tool = opendiff
[rerere]
enabled = 1
autoupdate = 1
[status]
submodulesummary = true
[user]
name = <your username>
email = <your email>
[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
[hub]
protocol = ssh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment