-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitconfig
259 lines (199 loc) · 7.29 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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
# https://git-scm.com/docs/git-config
# general config
[user]
name = Alexandru Bereghici
email = [email protected]
[github]
user = abereghici
[init]
defaultBranch = main
[apply]
# Detect whitespace errors when applying a patch
whitespace = fix
[rerere]
# Remember how you resolved a merge conflict and automatically reapply if it sees it again
enabled = true
[transfer]
# Avoid data corruption
fsckobjects = true
[core]
excludesFile = ~/.gitignore
# Make `git rebase` safer on macOS
# More info: https://www.git-tower.com/blog/make-git-rebase-safe-on-osx/
trustctime = false
[help]
# Correct typos
autoCorrect = 1
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
# Any GitHub repo with my username should be checked out r/w by default
# http://rentzsch.tumblr.com/post/564806957/public-but-hackable-git-submodules
[url "[email protected]:abereghici/"]
insteadOf = "git://github.com/abereghici/"
# When accidentally cloning the HTTP version of a repository instead of the SSH version
[url "[email protected]:"]
insteadOf = "https://github.com/"
# command-specific
[commit]
# Include the diff of the changes at the bottom of the commit message template
verbose = true
# Custom template for new commit messages
template = ~/.gitmessage
[log]
# Show branch names with git log
decorate = short
# Display dates as '2023-05-25 13:54:51' instead of 'Thu May 25 13:54:51 2023'
date = iso
[branch]
# Show most recently changed branches first
sort = -committerdate
[fetch]
# Automatically prune deleted branches and tags from your local copy
# when you fetch (or pull)
prune = true
pruneTags = true
[pull]
# Rebase branches on top of the fetched branch, instead of merging
# the default branch from the default remote
rebase = true
[push]
# When pushing code, always push only your current branch to a branch
# of the same name on the receiving end
# http://stackoverflow.com/a/23918418/89484
default = current
# Automatically set up upstream tracking
# when no upstream tracking exists for the current branch
autoSetupRemote = true
# Make `git push` automatically push relevant annotated tags when pushing branches out
followTags = true
# Make `push --force-with-lease` even safer by ensuring the tip of the remote
# was actually pulled into your local branch at some point
useForceIfIncludes = true
[rebase]
# Automatically include the `--autosquash` option when doing a `git rebase --interactive`
autoSquash = true
# aliases
[alias]
#
# Shortcuts
#
# Open .gitconfig in default editor
ecf = config --global -e
a = add
aa = add --all
c = commit
# Commit by adding all unstaged changes
ca = commit -a
cm = commit -m
cam = commit -am
cne = commit --no-edit
empty = commit --allow-empty -m
amend = commit --amend --no-edit
co = checkout
cob = checkout -b
# Jump back to to your last branch
prev = checkout -
# Discard all unstaged changes in the working tree and revert them to their state in the HEAD commit
discard = checkout .
br = branch
bra = branch -a
s = status
ss = status -sb
# Put all uncommitted changes in a temporary storage
st = stash
# Retrieve the last stored changes again
stp = stash pop
d = diff
cp = cherry-pick
fp = fetch --prune --all
f = reflog
pu = push
puf = push --force-with-lease
put = push --tags
# Pull in remote changes for the current repository and all its submodules
p = pull --recurse-submodules
# Rebase: skip a rebase step
skip = rebase --skip
# Rebase: abort
abort = rebase --abort
# Rebase: add changes and continue
cont = !git add . && git rebase --continue
# Compact and readable log
l = log --graph --pretty=format:'%C(magenta)%h%Creset%C(auto)%d%Creset %s %C(blue bold)— %cr ~ %an%Creset'
# Log with list of changed files per each commit
ls = log --stat --abbrev-commit
#
# First-aid
#
# Undo a `git push`
undopush = push -f origin HEAD^:master
# Unstage all staged changes but leave them in the working tree (mixed reset)
unstage = reset HEAD
# Undo last commit but don't throw away the changes (affects HEAD only)
undo = reset --soft HEAD~1
# Remove last commit (from HEAD, Index and Working Dir)
reset = reset --hard HEAD~1
#
# Helpers
#
# Show the user email for the current repository
whoami = config user.email
# List available aliases
aliases = config --get-regexp 'alias.*'
# Display the current branch name
branchname = rev-parse --abbrev-ref HEAD
# Copy the current branch name to the clipboard
cpbranchname = !git branchname | tr -d '\n' | tr -d ' ' | pbcopy
# Display the date of the last commit of the active Git branch
lastcommit = !git log --pretty=format:'%ar' | head -n 1
# List contributors with a number of their commits
contribs = shortlog -sn
# List of my own commits across all branches
my = !git log --all --no-merges --pretty=format:'%C(reset)%C(bold)%cd %C(reset)%C(white)%s %C(reset)%h' --date=short --author=\"$(git config user.name)\"
# How many lines of code I have written today
today = diff --shortstat \"@{0 day ago}\"
# count number of lines of code in the files of a git project
stats = "!git ls-files | xargs wc -l"
# List of branches ordered by last change
branches = for-each-ref --sort=-committerdate refs/heads/ --format='%(color:bold)%(refname:short)%(color:reset)\t%(committerdate:relative)'
# List of files with merge conflicts
wtf = diff --name-only --diff-filter=U
# Cancel local commits in the branch: git fuck master
fuck = "!f() { git reset --hard origin/$1; }; f"
# Delete all untracked files and folders
cfd = clean -fd
# Delete all changes, including untracked files and folders
nuke = !git reset --hard && git clean -fd
# Sharable diff with disabled syntax highlighting and +/- marks
patch = !git --no-pager diff --no-color
# Merge fresh master into the current branch
mmmr = !git fetch origin master && git merge origin/master --no-edit
# Merge fresh main into the current branch
mmmn = !git fetch origin main && git merge origin/main --no-edit
# Push up the branch and set upstream for the current branch
publish = "!git push --set-upstream origin $(git branch-name)"
sha = log -n 1 --pretty=format:'%H'
# git-delta
[add.interactive]
useBuiltin = false
[merge]
conflictStyle = zdiff3
[diff]
# Clearer diff output
algorithm = histogram
# Use different colors to highlight lines in diffs that have been “moved”
colorMoved = default
# Ignore indentation changes
colorMovedWS = allow-indentation-change
# include local/private config if relevant
[delta]
navigate = true # Use n and N to move between diff sections
side-by-side = true # Enables the side-by-side view
true-color = always
tabs = 2
hyperlinks = true
[include]
path = ~/.gitconfig.local