Skip to content

Instantly share code, notes, and snippets.

@BlackPrincess
Last active August 29, 2015 14:21
Show Gist options
  • Save BlackPrincess/f1be0b03a5fffe8e0a80 to your computer and use it in GitHub Desktop.
Save BlackPrincess/f1be0b03a5fffe8e0a80 to your computer and use it in GitHub Desktop.
[user]
name = Kurokawa
email = [email protected]
[color]
status = auto
diff = auto
branch = auto
interactive = auto
grep = auto
[pager]
log = diff-highlight | jless
show = diff-highlight | jless
diff = diff-highlight | jless
[merge]
keepBackup = false
tool = sublimerge
ff = false
[mergetool "sublimerge"]
# ln -s /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl
cmd = subl -n --wait \"$REMOTE\" \"$BASE\" \"$LOCAL\" \"$MERGED\" --command \"sublimerge_diff_views\"
trustExitCode = false
[mergetool "p4merge"]
cmd = p4merge "$BASE" "$LOCAL" "$REMOTE" "$MERGED"
keepTemporaries = false
trustExitCode = false
keepBackup = false
[difftool "sublimerge"]
cmd = subl -n --wait \"$REMOTE\" \"$LOCAL\" --command \"sublimerge_diff_views {\\\"left_read_only\\\": true, \\\"right_read_only\\\": true}\"
[difftool "p4diff"]
external = p4diff
[core]
excludesfile = /Users/toshiki.kurokawa/.gitignore
# fileMode = false # vcsでやるかcapでやるか…
autocrlf = input
quotepath = false
editor = emacs
sparsecheckout = true
[http]
sslVerify = false
[filter "media"]
clean = git media clean %f
smudge = git media smudge %f
required = true
[push]
default = simple
[pull]
rebase = true
[branch]
autosetuprebase = always
[alias]
# log
ranking = shortlog -s -n --no-merges
authorlog = "!f() { git log --no-merges --author=$1 --date=short --pretty=format:\"%Cgreen%h %Cblue%cd %Cred%cn%x09%Creset%s\" ;}; f"
logl = log --date=short --pretty=format:'%Cgreen%h %cd %Cblue%cn%x09%Creset%s'
log-all = log --graph --all --color --pretty='%x09%h %cn%x09%s %Cred%d%Creset'
branch-graph = log --graph --date-order -C -M --pretty=format:\"<%h> %ad [%an] %Cgreen%d%Creset %s\" --all --date=short
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
lga = log --graph --all --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
# branch
brr = branch -vv
no-merged-branch = branch -vv --no-merged
merged-branch = branch -vv --merged
clean-merged-branch = !git branch --merged | grep -v \\* | xargs -I % git branch -d %
# reset & clean
reseth = reset --hard
reset-clean = !git reset --hard HEAD && git clean -f -d
# pull
# pull-all = "!f() { git fetch origin; for branch in `git branch -r | grep origin | grep -v HEAD | awk -F'/' '{print $2}'`; do git checkout $branch; done;}; f"
# work
difff = diff --word-diff
cherry-color = "!f() { git cherry -v "$@" | awk '{ if($1 == \"+\"){ color = \"green\" } if($1 == \"-\"){ color = \"red\" } cmd = \"git show --date=short --no-notes --pretty=format:\\047%C\" color $1 \" %h %Cgreen%cd %Cblue%cn%x09%Creset%s\\047 --summary \" $2; cmd | getline t; close(cmd); print t }' ;}; f"
cherry-ticket-numbers = "!f() { git cherry -v "$@" | cut -b 44- | awk 'match($0, /#[0-9]+/) {print substr($0, RSTART, RLENGTH)}' | sort -u ;}; f"
# unmerge
add-unmerged = "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; git add `f`"
delete-unmerged = "!f() { git ls-files --deleted | cut -f2 | sort -u ; }; git rm `f`"
edit-unmerged = "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; vim `f`"
# short alias
co = checkout
s = status
br = branch
c = commit
r = rebase
m = merge
puu = push -u
cop = "!f () { git branch -a --no-color | peco | sed 's/^[ *]*//'; }; g () { if [ -z $1 ]; then git checkout `f`; else git checkout $*; fi }; g"
# notify
e-notice = "!f(){ git log --oneline -n 1 | xargs -I % curl --data-urlencode \"source=%\" https://idobata.io/hook/f706fec1-a313-4c31-a050-7a4f2ba42fe7 | echo; }; f"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment