-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitconfig
213 lines (190 loc) · 6.64 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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
[include]
# secrets
path = ~/.gitconfig.local
[core]
editor = nvim
excludesfile = /home/rando/.gitignore.global
askpass = /usr/bin/ksshaskpass
attributesfile = /home/rando/.gitattributes
; difftool = true
; pager = diff-so-fancy | less --tabs=4 -RFX
pager = less --tabs=4 -RFX
; askpass = /usr/bin/ssh-askpass
[branch]
mergeoptions = no-ff
autosetupmerge = always
autosetuprebase = always
[checkout]
defaultRemote = origin
[pull]
rebase = true
[color]
diff = auto
status = auto
branch = auto
interactive = auto
ui = auto
[rebase]
autoSquash = true
autoStash = true
[alias]
b = branch
p = pull
co = checkout
ci = commit -a
a = add
st = status -sb
dft = difftool
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%C(bold blue)<%an>%Creset' --abbrev-commit
lol = log --pretty=oneline --abbrev-commit --graph --decorate
graph = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative
addw = "!git diff -w --no-color | git apply --cached --ignore-whitespace"
prc = "!hub -c core.commentChar='%' pull-request"
pf = push --force-with-lease
# Branch List with age and details
bl = "!git for-each-ref --sort=-committerdate refs/heads \
--format='%(color:green)%(committerdate:relative)|%(HEAD)%(color:yellow)%(refname:short)|%(color:magenta)%(authorname)%(color:reset)|%(subject)' \
--color=always \
| column -ts'|' -T4 -c$(($(tput cols) + 30))"
# commiting
c = commit -m
ca = commit --amend
cf = commit --fixup
# make a fixup commit for the last time the file was modified
cff = "!f() { [ -n $@ ] && git add $@ && git commit --fixup $(git last-sha $@); }; f"
# rebasing
rb = rebase
rbm = "!git rebase --interactive $(git default-branch)"
rbi = rebase --interactive
rbc = rebase --continue
rba = rebase --abort
# Rebase commits on current branch, without adding in new commits from master
rbb = "!git rebase -i `git merge-base $(git default-branch) HEAD`"
# worktree
wt = worktree
#
# Working with branches
#
# Get latest sha for file(s)
last-sha = log -n1 --pretty=format:%h --grep 'fixup!' --invert-grep
# Get the current branch name (not so useful in itself, but used in
# other aliases)
branch-name = "!git rev-parse --abbrev-ref HEAD"
# Push the current branch to the remote "origin", and set it to track
# the upstream branch
publish = "!git push -u origin $(git branch-name):$(git branch-name)"
# Delete the remote version of the current branch
unpublish = "!git push origin :$(git branch-name)"
# Delete a branch and recreate it from master — useful if you have, say,
# a development branch and a master branch and they could conceivably go
# out of sync
recreate = "!f() { [[ -n $@ ]] && git checkout \"$@\" && git unpublish && git checkout master && git branch -D \"$@\" && git checkout -b \"$@\" && git publish; }; f"
# Default "upstream" branch name (master, main, staging, etc...)
default-branch = !git symbolic-ref refs/remotes/origin/HEAD | cut -d/ -f4
# Fire up your difftool (e.g. Kaleidescope) with all the changes that
# are on the current branch.
code-review = difftool origin/master...
# Given a merge commit, find the span of commits that exist(ed) on that
# branch. Again, not so useful in itself, but used by other aliases.
merge-span = "!f() { echo $(git log -1 $2 --merges --pretty=format:%P | cut -d' ' -f1)$1$(git log -1 $2 --merges --pretty=format:%P | cut -d' ' -f2); }; f"
# Find the commits that were introduced by a merge
merge-log = "!git log `git merge-span .. $1`"
# Show the changes that were introduced by a merge
merge-diff = "!git diff `git merge-span ... $1`"
# As above, but in your difftool
merge-difftool = "!git difftool `git merge-span ... $1`"
#
# Working with files
#
# Unstage any files that have been added to the staging area
unstage = reset HEAD
# Show changes that have been staged
diffc = diff --cached
# Mark a file as "assume unchanged", which means that Git will treat it
# as though there are no changes to it even if there are. Useful for
# temporary changes to tracked files
assume = update-index --assume-unchanged
# Reverse the above
unassume = update-index --no-assume-unchanged
# Show the files that are currently assume-unchanged
assumed = "!git ls-files -v | grep ^h | cut -c 3-"
# Checkout our version of a file and add it
ours = "!f() { git checkout --ours $@ && git add $@; }; f"
# Checkout their version of a file and add it
theirs = "!f() { git checkout --theirs $@ && git add $@; }; f"
# Delete any branches that have been merged into current branch
# See also: https://gist.github.com/robmiller/5133264
cleanup-branches = "!git branch --merged | grep -v '\\*' | grep -v '\\+' | xargs git branch -d"
[format]
pretty = %C(magenta reverse)%h%Creset %Cgreen[%cr]%Creset (%an) %s
[status]
submodulesummary = true
[apply]
whitespace = fix
[color "status"]
added = yellow
changed = green
untracked = cyan
[format]
pretty = %Cblue%h%Creset %Cgreen[%cr]%Creset (%an) %s
[push]
default = simple
[blame]
ignoreRevsFile = .git-blame-ignore-revs
[sendemail]
smtpserver = smtp.gmail.com
smtpserverport = 587
smtpencryption = tls
smtpuser = psadauskas@gmail.com
[credential]
; helper = /usr/share/doc/git/contrib/credential/libsecret/git-credential-libsecret
helper = /usr/libexec/git-core/git-credential-libsecret
[credential "https://github.com"]
username = paul
[hub]
protocol = https
[user]
name = Paul Sadauskas
email = psadauskas@gmail.com
signingkey = 02DF4AA81F43CF58
[filter "lfs"]
clean = git lfs clean %f
smudge = git lfs smudge %f
required = true
[commit]
gpgsign = true
[fetch]
prune = true
[rerere]
enabled = true
autoUpdate = true
[gpg]
program = gpg2 ; fedora
; program = gpg ; ubuntu
[init]
defaultBranch = main
[pager]
difftool = true
[merge]
tool = kdiff3
conflictstyle = diff3 # show original content before conflicts
[diff]
wordRegex = [^[:space:]] # For Github-style word diffs
algorithm = patience # combine "functions" together in diff
; tool = nvimdiff
; tool = difftastic
; external = difft
[difftool]
prompt = false
[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
[difftool "vscode"]
cmd = code --wait --diff $LOCAL $REMOTE
[difftool "nvimdiff"]
cmd = "nvim -d \"$LOCAL\" \"$REMOTE\""
[difftool "difftastic"]
cmd = difft "$LOCAL" "$REMOTE"