-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitconfig
192 lines (184 loc) · 7.21 KB
/
.gitconfig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
[user]
name = komei-otake-biz
email = [email protected]
[color]
# colorの設定(以下のコマンドは自動で色つける)
status = auto
diff = auto
branch = auto
interactive = auto
grep = auto
[push]
default = current
[core]
excludesfile = ~/.gitignore # globalな.gitignoreの指定
autocrlf = false # CRLFを自動変換
editor = vim
quotepath = false
[merge]
tool = vimdiff
ff = false
[diff]
tool=vimdiff
[branch]
autosetuprebase = always
[pull]
rebase = true
[pager]
log = diff-highlight | less
show = diff-highlight | less
diff = diff-highlight | less
[alias]
s = status
st = status
ss = status -s
sh = show
so = remote show origin
# pull/push/fetch
ft = fetch
ftp = fetch --prune
up = pull --rebase # pull rebase
po = push origin # push origin
pof = push -f origin # force
pu = push -u origin # push origin and set upstream
# push current branch to origin with --upstream
puc = "!f() { git push origin -u `git symbolic-ref --short HEAD` ;}; f"
# rebase
rbm = rebase --merge master # masterへのrebaseはよく使うのでalias
rbd = rebase --merge develop
rbc = rebase --continue
rba = rebase --abort
rbi = rebase -i
rbi1 = rebase -i HEAD^
rbi2 = rebase -i HEAD^^
rbi3 = rebase -i HEAD^^^
rbi4 = rebase -i HEAD^^^^
rbi5 = rebase -i HEAD^^^^^
# merge
mn = merge --no-ff
rebase-and-merge = "!f() { git checkout $2 && git rebase --merge --no-ff $1 && git checkout $1 && git merge --no-ff $2 && echo '' && echo \"branch $2 is rebased onto $1 and merged into $1\"; }; f"
ram = "!f() { git rebase-and-merge $1 $2 ;}; f"
# comit
ad = add
c = commit
ci = commit -a # modifiedなファイルを全てstageへ
cam = commit -a --amend # 直前のcommitを修正
co = checkout
cb = checkout -b # branch切ってcheckoutする
ct = checkout --track # remoteのbranchを追跡
cm = checkout master
cd = checkout develop
# branch関連
br = branch
ba = branch -a # originも含めた全てのbranchを表示
bm = branch --merged # merge済みのbranchを表示
bn = branch --no-merged # mergeしてないbranchを表示
bo = branch -r # remote branchを表示
# log関連
edit-unmerged = "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; vim `f`"
wc = whatchanged # logに変更されたファイルも一緒に出す
ls = log --stat # logに変更されたファイルも一緒に出す
lp = log -p # diffも一緒に出す
la = log --pretty=\"format:%ad %h (%an): %s\" --date=short # ざっくりログ出す
lr = log origin # originのlog
ll = log --date=short --pretty=format:'%Cgreen%h %cd %Cblue%cn%x09%Creset%s' # onelineでlogを出す
ll1 = log --date=short --max-count=1 --pretty=format:'%Cgreen%h %cd %Cblue%cn%x09%Creset%s' # onelineでlogを出す
lll = log --date=short --max-count=10 --pretty=format:'%Cgreen%h %cd %Cblue%cn%x09%Creset%s' # onelineでlogを出す
oneline = log --pretty=oneline
ranking = shortlog -s -n --no-merges
# logをtree表示
log-graph = log --graph --date=short --pretty=format:'%Cgreen%h %cd %Cblue%cn %Creset%s'
log-all = log --graph --all --color --pretty='%x09%h %cn%x09%s %Cred%d%Creset'
# reset
r = reset HEAD
r1 = reset HEAD~
r2 = reset HEAD~~
r3 = reset HEAD~~~
r4 = reset HEAD~~~~
r5 = reset HEAD~~~~~
rsh = reset --soft HEAD
rsh1 = reset --soft HEAD~
rsh2 = reset --soft HEAD~~
rsh3 = reset --soft HEAD~~~
rsh4 = reset --soft HEAD~~~~
rsh5 = reset --soft HEAD~~~~~
rhh = reset --hard HEAD # 取り返しのつかないことをしてしまった……!
rhh1 = reset --hard HEAD~
rhh2 = reset --hard HEAD~~
rhh3 = reset --hard HEAD~~~
rhh4 = reset --hard HEAD~~~~
rhh5 = reset --hard HEAD~~~~~
# git reset --hard HEAD を安全にした - 永遠に未完成 http://d.hatena.ne.jp/thinca/20120924/1348491052
cancel = !git commit -a -m 'Temporary commit for cancel' && git reset --hard HEAD~
# diff関連
di = diff
dm = diff master # masterとのdiff
dw = diff --color-words # 単語単位でいろつけてdiff
dc = diff --cached # addされているものとのdiff
ds = diff --staged # 同上(1.6.1移行)
d1 = diff HEAD~ # HEADから1つ前とdiff
d2 = diff HEAD~~ # HEADから2つ前とdiff
d3 = diff HEAD~~~ # HEADから3つ前とdiff
d4 = diff HEAD~~~~ # HEADから4つ前とdiff
d5 = diff HEAD~~~~~ # HEADから5つ前とdiff
d10 = diff HEAD~~~~~~~~~~ # HEADから10前とdiff
# edit関連
# modified or untrackedなファイルを編集する
edit = "!f() { git status -s | cut -b 4- | grep -v '\\/$' | uniq ; }; vim `f`"
# mergeの際にconflictが起きたファイルを編集
edit-unmerged = "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; vim `f`"
# mergeの際にconflictが起きたファイルをadd
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`"
# 指定したコミットで変更されたファイルを編集する
modified = "!f() { git diff $1..$1\\^ --name-only | xargs sh -c 'vim "$@" < /dev/tty' - ;}; f"
# cherr -vで出てくる;commitから#1234なチケット番号を切り出す
cherry-ticket-numbers = "!f() { git cherry -v "$@" | cut -b 44- | awk 'match($0, /#[0-9]+/) {print substr($0, RSTART, RLENGTH)}' | sort -u ;}; f"
# cherr -vに含まれるチケットを列挙する
cherry-tickets = "!f() { git cherry -v "$@" | cut -b 44- | awk 'match($0, /#[0-9]+/) {print substr($0, RSTART+1, RLENGTH-1)}' | sort -u | xargs git issue --oneline ;}; f"
# colorized cheery -v
cch= "!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"
# blame
blame-at = "!f() { git blame $1 | sed -n $2P | cut -d ' ' -f1 | xargs git show ;}; f"
# grep関連
gr = grep
gn = grep -n
sm = submodule
smupdate = submodule foreach "git checkout master; git pull origin master"
# stash関連
sl = stash list
sp = stash pop
ss = stash save
chpk = cherry-pick
iss = issue # my extended command
# git-flow関連
ff = flow feature
ffl = flow feature list
ffs = flow feature start
fff = flow feature finish
ffc = flow feature checkout
ffp = flow feature publish
fr = flow release
fh = flow hotfix
fhl = flow hotfix list
fhs = flow hotfix start
fhf = flow hotfix finish
fhp = flow hotfix publish
fs = flow support
fhd = "!f() { git branch | grep hotfix | xargs git branch -D ;}; f"
fizzbuzz = "!f() { seq "$@" | awk '$0=NR%15?NR%5?NR%3?$0:\"Fizz\":\"Buzz\":\"FizzBuzz\"' ;}; f"
[http]
sslVerify = false
[tig "bind"]
generic = g move-first-line
generic = G move-last-line
generic = <Ctrl-F> move-page-down
generic = <Ctrl-B> move-page-up
[ghq]
root = /Users/komei/src
[rerere]
enabled = true
[mergetool]
keepBackup = false
[ruby]
version = 2.2.4