-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitconfig
162 lines (143 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
[core]
excludesfile = ~/.gitignore_global
editor = vim
pager = diff-so-fancy | less --tabs=4 -RFX
# Don't consider trailing space change as a cause for merge conflicts
whitespace = -trailing-space
[color]
ui = auto
branch = auto
diff = auto
status = auto
[color "branch"]
current = red reverse
local = blue
remote = green
[color "diff"]
meta = 11
frag = magenta bold
func = 146 bold
commit = yellow bold
old = red bold
new = green bold
whitespace = red reverse
plain = white
[color "diff-highlight"]
oldNormal = red bold
oldHighlight = red bold 52
newNormal = green bold
newHighlight = green bold 22
[color "status"]
added = yellow
changed = green
untracked = cyan
[alias]
stash-all = stash save --include-untracked
# ensures that when you stash,
# you catch the new files you haven't caught with a git add yet
# https://git-scm.com/docs/git-stash
# conflict/merges
ours = "!f() { git co --ours $@ && git add $@; }; f"
theirs = "!f() { git co --theirs $@ && git add $@; }; f"
# list remotes
rem="!git config -l | grep remote.*url | tail -n +2"
# apply patch from other local repo
lap = "!f() { git --git-dir=$1 format-patch -k -1 --stdout $2 | git am -3 -k; }; f"
# open markdown files edited in last commit
last = "!vim $(git show HEAD --format="" --name-only | grep -e .*md$ | xargs)"
# open just created markdown in working directory
newmd = "!vim $(git status -s | awk {'print $2'})"
# initial empty commit
empty = "!git commit -am\"[empty] Initial commit\" --allow-empty"
# list all aliases
la = "!git config -l | grep alias | cut -c 7-"
# Command shortcuts
ci = commit
co = checkout
st = status
# Display tree-like log, because default log is a pain…
lg = log --graph --date=relative --pretty=tformat:'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%an %ad)%Creset'
# Useful when you have to update your last commit
# with staged files without editing the commit message.
oops = commit --amend --no-edit
# Ensure that force-pushing won't lose someone else's work (only mine).
push-with-lease = push --force-with-lease
# Rebase won’t trigger hooks on each "replayed" commit.
# This is an ugly hack that will replay each commit during rebase with the
# standard `commit` command which will trigger hooks.
rebase-with-hooks = rebase -x 'git reset --soft HEAD~1 && git commit -C HEAD@{1}'
# List local commits that were not pushed to remote repository
review-local = "!git lg @{push}.."
# Edit last commit message
reword = commit --amend
# Undo last commit but keep changed files in stage
uncommit = reset --soft HEAD~1
# Remove file(s) from Git but not from disk
untrack = rm --cache --
hub = !hub
[push]
# Default push should only push the current branch to its push target, regardless of its remote name
default = upstream
# Because I get sick of telling git to do it manually
# https://git-scm.com/docs/git-config#git-config-pushfollowTags
followTags = true
[pull]
default = current
rebase = false
[fetch]
prune = true
[rebase]
# Automatically stash current WD and stage when running rebase
# then you won't have to manually `git stash push` and `git stash pop`
# after and before your rebase.
autoStash = true
# Automagically reorder and prefix your commands while doing an interactive rebase.
autoSquash = true
[grep]
lineNumber = true
[log]
# Use abbrev SHAs whenever possible/relevant instead of full 40 chars
abbrevCommit = true
# Automatically --follow when given a single path
follow = true
# Disable decorate for reflog
# (because there is no dedicated `reflog` section available)
decorate = false
[tag]
# Sort tags as version numbers whenever applicable, so 1.10.2 is AFTER 1.2.0.
sort = version:refname
[commit]
gpgSign = false
# other people can trust that the changes you've made really were made by you
# https://help.github.com/articles/about-gpg/
# https://git-scm.com/docs/git-config#git-config-commitgpgSign
[status]
showUntrackedFiles = all
# Sometimes a newly-added folder, since it's only one line in git status, can slip under the radar.
# https://git-scm.com/docs/git-config#git-config-statusshowUntrackedFiles
[diff]
# Use icdiff as default diff tool when running `git diff-tool`
tool = icdiff
# Use better, descriptive initials (c, i, w) instead of a/b.
mnemonicPrefix = true
# Show renames/moves as such
renames = true
colorMoved = zebra
[difftool]
prompt = false
[difftool "icdiff"]
cmd = icdiff $LOCAL $REMOTE --highlight --line-numbers
[interactive]
diffFilter = diff-so-fancy --patch
[apply]
whitespace = nowarn
[filter "lfs"]
clean = git-lfs clean %f
smudge = git-lfs smudge %f
required = true
[help]
autocorrect = 1
[http]
sslVerify = false
[hub]
protocol = ssh