-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitconfig
165 lines (140 loc) · 4.74 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
[color]
ui = auto
status = auto
diff = auto
branch = auto
interactive = auto
grep = auto
[help]
autocorrect = 1
[push]
default = tracking
autoSetupRemote = true
[alias]
s = status
st = status
sh = show
so = remote show origin
ft = fetch
up = pull --rebase # pull rebase
rbm = rebase master # masterへのrebaseはよく使うのでalias
ad = add
ci = commit
cia = commit -a # modifiedなファイルを全てstageへ
cam = commit -a --amend # 直前のcommitを修正
co = checkout
cb = checkout -b # branch切ってcheckoutする
cm = checkout master
cp = cherry-pick
# branch関連
br = branch
ba = branch -a # originも含めた全てのbranchを表示
bm = branch --merged # merge済みのbranchを表示
bn = branch --no-merged # mergeしてないbranchを表示
# log関連
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
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 --no-merges --graph --all --color --pretty='%x09%h %cn%x09%s %Cred%d%Creset'
# 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
# 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`"
# grep関連
gr = grep
gn = grep -n
hist = log --pretty=format:\\\"%h %ad | %s%d [%an]\\\" --graph --date=short
# open unmerged files.
edit-unmerged = "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; vim -p +/\\<\\<\\<\\<\\<\\< `f`"
# A shortcut for seeing the fetched commits
lc = log ORIG_HEAD.. --stat --no-merges
# undo
undo=reset --hard
# These two aliases wrap commonly used options to git diff, and accept the full range of arguments that diff accepts:
changes=diff --name-status -r
diffstat=diff --stat -r
# To see what new commits have been created by the last command (typically after a "git pull") :
new = !sh -c 'git log $1@{1}..$1@{0} "$@"'
# Here are two aliases suggested on the mailing list by Junio Hamano:
# Try then by yourself! The first takes the name of a person or their email address. The second takes a commit name.
whois = "!sh -c 'git log -i -1 --pretty=\"format:%an <%ae>\n\" --author=\"$1\"' -"
whatis = show -s --pretty='tformat:%h (%s, %ad)' --date=short
pushf = push --force-with-lease
fame = !python -m gitfame
[core]
editor = vim
pager = delta
excludesfile = ~/.gitignore
quotepath = false
[status]
diff = auto
[branch]
diff = auto
autosetuprebase = always
[color "diff"]
meta = cyan bold
old = yellow
[color "diff.add"]
old = magenta
[http]
sslVerify = false
[log]
date = local
[pager]
# log = diff-highlight | less
# show = diff-highlight | less
# diff = diff-highlight | less
[rerere]
enabled = true
[filter "media"]
clean = git-media-clean %f
smudge = git-media-smudge %f
[filter "lfs"]
clean = git lfs clean %f
smudge = git lfs smudge %f
required = true
[pull]
rebase = true
[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
[init]
defaultBranch = main
[commit]
template = ~/.git_commit_template
[interactive]
diffFilter = delta --color-only
[delta]
navigate = true # use n and N to move between diff sections
light = false # set to true if you're in a terminal w/ a light background color (e.g. the default macOS terminal)
[merge]
conflictstyle = diff3
[diff]
colorMoved = default
[user]
email = [email protected]
[rebase]
autostash = true
abbreviateCommands = true
autosquash = true