-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgitconfig
More file actions
271 lines (246 loc) · 8.46 KB
/
gitconfig
File metadata and controls
271 lines (246 loc) · 8.46 KB
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
260
261
262
263
264
265
266
267
268
269
270
271
# Author Stephen Martin
# Global Git configuration
# {{{ Global Configuration
[color]
ui= true
[color "branch"]
current = green reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
# old = strike red
# new = ul green
[core]
filemode = false
autocrlf = false
editor = /usr/bin/vim
pager = delta
[delta]
navigate = true # use n and N to move between diff sections
light = false # set to true if you're terminal w/a light background color
[diff]
tool = vimdiff
# wordRegex = .
colorMoved = default
[difftool]
prompt = false
[gc]
reflogExpire = 200
reflogExpireUnreachable = 90
[init]
defaultBranch = master
[interactive]
diffFilter = delta --color-only
[pretty]
color = tformat:%Cred%h%Creset -%C(green)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset
[push]
default = simple
[credential]
helper = store
[user]
name = Stephen Martin
email = smartin5590@gmail.com
[mergetool]
keepBackup = false
[merge]
summary = true
verbosity = 1
tool = vimdiff
conflictstyle = diff3
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
required = true
process = git-lfs filter-process
[pull]
rebase = true
[tag]
sort = v:refname
[credential "https://github.com"]
helper =
helper = !'C:\\Program Files\\GitHub CLI\\gh.exe' auth git-credential
[credential "https://gist.github.com"]
helper =
helper = !'C:\\Program Files\\GitHub CLI\\gh.exe' auth git-credential
# }}}
# {{{ Aliases
[alias]
# XXX TEMPLATE: XXX
# changeme = "!f() { changemetoo }; f"
fmode = config --local core.filemode false
lf = config --local core.autocrlf false
nocr = config --local core.autocrlf false
aliases = config --get-regexp alias
la = "!git config -l | grep alias "
z = status -z -u
# Add a new remote to the current repository, $1=Name(origin), $2=URL(git@github.com/...)
ra = "!f() { git remote add $1 $2; }; f"
# some log aliases
history = log
h = !git log | cat
hh = !git log | batcat
last = log -1 HEAD
l = log --pretty=oneline --graph --all --abbrev-commit
dog = log --decorate --oneline --graph
oneline = log --oneline
lcm = log --pretty=oneline --graph --all
ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
lshort = log --pretty=format:\"%h %cr %C(yellow)%cn %Cgreen%s%Creset\"
lnc = log --pretty=format:"%h\\ %s\\ [%cn]"
# Added dates:
ld = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative
lds = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short
# Pretty simple
le = log --oneline --decorate
# Show history of file or files
filelog = log -u
fl = log -u
# Because it sux that it can't figure this out:
logs = log
# Inspect recent history
dl = !git ll -1
dlc = diff --cached HEAD^
# Find a file path in codebase:
f = "!git ls-files | grep -i"
# Find branches containing commit
fb = "!f() { git branch -a --contains $1; }; f"
# Find branches containing commit
ft = "!f() { git describe --always --contains $1; }; f"
# Find commit by commit message/comment
fm = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short --grep=\"$1\"; };f"
g = !exec git
# Search for a file containing a string
gr = grep -Ii
gra = "!f() { A=$(pwd) && TOPLEVEL=$(git rev-parse --show-toplevel) && cd $TOPLEVEL && git grep --full-name -In $1 | xargs -I{} echo $TOPLEVEL/{} && cd $A; } ; f"
# Show the diff between the latest commit and the current state
d = !"git diff-index --quiet HEAD -- || clear -x ; git --no-pager diff --patch-with-stat"
dif = diff --color-words
# Show the diff between the "number" of revisions ago and current state
di = !"d() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear -x; d"
# Diff to a specific commit passed as parameter
dr = "!f() { git diff "$1"^.."$1"; }; f"
diffr = "!f() { git diff "$1"^.."$1"; }; f"
# make a patch file
patch = !git --no-pager diff --no-color
lc = "!f() { git ll "$1"^.."$1"; }; f"
# Pull in all of the remote changes including submodules
# p = !"git pull ; git submodule foreach git pull origin master"
p = !git pull
sm = submodule
sma =submodule add
# Start new work
# I don't really work with submodules now
# up = !git pull --rebase --prune $@ && git submodule update --init --recursive
up = !git pull --rebase --prune $@
# Go to a branch, creating if necessary:
go ="!f() { git checkout -b \"$1\" 2> /dev/null || git checkout \"$1\"; }; f"
# Because I forget that git isn't SVN
info = status
# Edit the global config file
# e = config --global -e
edit = !vim ~/.gitconfig
e = !vim ~/.gitconfig
vim = !vim ~/.gitconfig
# Just show the date in compressed format
dt = !date +"%Y%m%dT%H%M%S"
# Longer format
dtl = !date '+"%Y/%m/%d %H:%M:%S"'
# seconds since epoch
dts = !date +'%s'
pullall = pull --all
pushall = !git remote | xargs -I X git push X --all
pushtags = !git remote | xargs -I X git push X --tags
# Note that this DOES NOT add UNTRACKED files to the repository:
cm = commit -m
# Note that this adds UNTRACKED files to the repository:
ca = commit -am
# Saves Work in Progress. Leaves untracked alone.
wip = commit -am "WIP"
# Likewise, saves it all as a (probably temporary) checkpoint:
save = !git add -A && git commit -m 'SAVEPOINT'
# Then use this to restore (roll back) the previous working session.
undo = reset HEAD~1 --mixed
# Add changes and a new note to the already commited HEAD
amend = commit -a --amend --reuse-message=HEAD
# Credit an author on the latest commit
credit = "!f() {git commit --amend --author \"$1 <$2>\" -C HEAD; }; f"
# Proper way to do a reset, leave stuff in repository for safety
# It is saved to a commit that will be hard to restore, but is available
wipe = !git add -A && git commit -qm 'WIPE SAVEPOINT' && git reset HEAD~1 --hard
# Clean up branches
bclean = "!f() { git branch --merged ${1-master} | grep -v " ${1-master}$" | xargs -r git branch -d; }; f"
# Better for me I think:
brm = "!f() { if [ ! -z \"$1\" ]; then git branch -d $1 ; else echo No branch named.; fi; }; f"
# Clean up/delete current branch (e.g. dev), co master and start some new work. Follow with cob
bdone = "!f() { git checkout ${1-master} && git up && git bclean ${1-master}; }; f"
# Rename 'branch' to 'done-branch'
done = "!f() { git branch | grep \"$1\" | cut -c 3- | grep -v done | xargs -I{} git branch -m {} done-{}; }; f"
# Mark a file to make git assume it is unchanged (don't commit it)
assume = update-index --assume-unchanged
# Change a file back to being managed by git:
unassume = update-index --no-assume-unchanged
# Show assumed files:
assumed = "!git ls-files -v | grep "^h" | cut -c 3-"
# Unassume all assumed files:
unassumeall = "!git assumed | xargs git unassume"
# And assume all, good for starting up in a repository managed by something
# else like SVN
assumeall = "!git st -s | awk {'print $2'} | xargs git assume"
# TAGGING
# Show the last tag created:
lasttag = describe --tags --abbrev=0
lt = describe --tags --abbrev=0
ltn = "!git tag -n --sort=v:refname | tail -1"
# Show verbose output of tags and branches and remotes
tags = tag -n
branches = branch -a
br = branch
b = branch -v
bs = branch -a
remotes = remote -v
rv = remote -v
r = remote -v
# Merge aliases
mm = merge master
# Checkout commits I've made
ours = "!f() { git co --ours $@ && git add $@; }; f"
# Checkout commits from the repo that need merging with mine
theirs = "!f() { git co --theirs $@ && git add $@; }; f"
# Basic shortcuts
# cp = cherry-pick
sb = status -sb
s = status -s
st = status
c = clone --recursive
cl = clone
# Saves some typing like the old 'svn ci'
commit = ci
# Saves some typing like the old 'svn co'
cc = checkout -- .
co = checkout
cp = checkout -
# Prepare to work on a new branch:
cob = checkout -b
diff = diff --word-diff
dc = diff --cached
f = fetch
# Reset Commands
# Reset progressively further back and harder
# r = reset
# HEAD -1
r1 = reset HEAD^
# HEAD -2
r2 = reset HEAD^^
rh = reset --hard
rh1 = reset HEAD^ --hard
rh2 = reset HEAD^^ --hard
# Stash Operations
sl = stash list
sa = stash apply
ss = stash save
t = !tig
# }}}
#vim: set et sw=2 foldmethod=marker