548 lines
8.3 kB
1
RWX_GIT_LOG_FORMAT="\
2
%C(auto)%h%d
3
S %C(red)%GS
4
A %C(green)%an %ae
5
%C(green)%ai
6
C %C(blue)%cn %ce
7
%C(blue)%ci
8
%B"
9
10
# add to index
11
ga() { a__git_add "${@}"; }
12
a__git_add() {
13
git \
14
add \
15
"${@}"
16
}
17
18
# add all to index
19
gaa() { a__git_add_all "${@}"; }
20
a__git_add_all() {
21
git \
22
add \
23
--all \
24
"${@}"
25
}
26
27
# add parts of all to index
28
gaap() { a__git_add_all_patch "${@}"; }
29
a__git_add_all_patch() {
30
git \
31
add \
32
--all \
33
--patch \
34
"${@}"
35
}
36
37
# add parts to index
38
gap() { a__git_add_patch "${@}"; }
39
a__git_add_patch() {
40
git \
41
add \
42
--patch \
43
"${@}"
44
}
45
46
# create a branch
47
gb() { a__git_branch "${@}"; }
48
a__git_branch() {
49
git \
50
branch \
51
"${@}"
52
}
53
54
# delete a branch
55
gbd() { a__git_branch_delete "${@}"; }
56
a__git_branch_delete() {
57
git \
58
branch \
59
--delete \
60
"${@}"
61
}
62
63
# force a branch deletion
64
gbdf() { a__git_branch_delete_force "${@}"; }
65
a__git_branch_delete_force() {
66
git \
67
branch \
68
--delete \
69
--force \
70
"${@}"
71
}
72
73
# list branches
74
gbl() { a__git_branch_list "${@}"; }
75
a__git_branch_list() {
76
git \
77
branch \
78
--all \
79
--list \
80
--verbose \
81
--verbose \
82
"${@}"
83
}
84
85
# set the link to a remote branch from a local branch
86
gbsu() { a__git_branch_set_upstream "${@}"; }
87
a__git_branch_set_upstream() {
88
git \
89
branch \
90
--set-upstream-to \
91
"${@}"
92
}
93
94
# switch to a branch or checkout file(s) from a commit
95
gc() { a__git_checkout "${@}"; }
96
a__git_checkout() {
97
git \
98
checkout \
99
"${@}"
100
}
101
102
# checkout an orphan branch
103
gco() { a__git_checkout_orphan "${@}"; }
104
a__git_checkout_orphan() {
105
git \
106
checkout \
107
--orphan \
108
"${@}"
109
}
110
111
# pick a commit
112
gcp() { a__git_cherry_pick "${@}"; }
113
a__git_cherry_pick() {
114
git \
115
cherry-pick \
116
"${@}"
117
}
118
119
# abort the commit pick
120
gcpa() { a__git_cherry_pick_abort "${@}"; }
121
a__git_cherry_pick_abort() {
122
git \
123
cherry-pick \
124
--abort \
125
"${@}"
126
}
127
128
# continue the commit pick
129
gcpc() { a__git_cherry_pick_continue "${@}"; }
130
a__git_cherry_pick_continue() {
131
git \
132
cherry-pick \
133
--continue \
134
"${@}"
135
}
136
137
# clean untracked files
138
gcf() { a__git_clean_force "${@}"; }
139
a__git_clean_force() {
140
git \
141
clean \
142
-d \
143
--force \
144
"${@}"
145
}
146
147
# redo the last commit with a different message
148
gcam() { a__git_commit_amend_message "${@}"; }
149
a__git_commit_amend_message() {
150
git \
151
commit \
152
--amend \
153
--message \
154
"${@}"
155
}
156
157
# make a root commit
158
gcem() { a__git_commit_empty_message "${@}"; }
159
a__git_commit_empty_message() {
160
git \
161
commit \
162
--allow-empty \
163
--allow-empty-message \
164
--message \
165
"${@}"
166
}
167
168
# commit the index
169
gcm() { a__git_commit_message "${@}"; }
170
a__git_commit_message() {
171
git \
172
commit \
173
--message \
174
"${@}"
175
}
176
177
# configure the user email
178
gcue() { a__git_config_user_email "${@}"; }
179
a__git_config_user_email() {
180
git \
181
config \
182
"user.email" \
183
"${@}"
184
}
185
186
# configure the user name
187
gcun() { a__git_config_user_name "${@}"; }
188
a__git_config_user_name() {
189
git \
190
config \
191
"user.name" \
192
"${@}"
193
}
194
195
# differences from last or between commits
196
gd() { a__git_diff "${@}"; }
197
a__git_diff() {
198
git \
199
diff \
200
"${@}"
201
}
202
203
# display what is indexed in cache
204
gdc() { a__git_diff_cached "${@}"; }
205
a__git_diff_cached() {
206
git \
207
diff \
208
--cached \
209
"${@}"
210
}
211
212
# indexed character-level differences
213
gdcw() { a__git_diff_cached_word "${@}"; }
214
a__git_diff_cached_word() {
215
git \
216
diff \
217
--cached \
218
--word-diff-regex "." \
219
"${@}"
220
}
221
222
# differences via external tool
223
gdt() { a__git_diff_tool "${@}"; }
224
a__git_diff_tool() {
225
git \
226
difftool \
227
--dir-diff \
228
"${@}"
229
}
230
231
# character-level differences
232
gdw() { a__git_diff_word "${@}"; }
233
a__git_diff_word() {
234
git \
235
diff \
236
--word-diff-regex "." \
237
"${@}"
238
}
239
240
# fetch from the remote repository
241
gf() { a__git_fetch "${@}"; }
242
a__git_fetch() {
243
rwx_gpg_agent_update &&
244
git \
245
fetch \
246
--tags \
247
--verbose \
248
"${@}"
249
}
250
251
# fetch from remote repository and prune local orphan branches
252
gfp() { a__git_fetch_prune "${@}"; }
253
a__git_fetch_prune() {
254
a__git_fetch \
255
--prune \
256
"${@}"
257
}
258
259
# garbage collect all orphan commits
260
ggc() { a__git_garbage_collect "${@}"; }
261
a__git_garbage_collect() {
262
git \
263
reflog \
264
expire \
265
--all \
266
--expire "all" &&
267
git \
268
gc \
269
--aggressive \
270
--prune="now"
271
}
272
273
# initialize a new repository
274
gi() { a__git_init "${@}"; }
275
a__git_init() {
276
git \
277
init \
278
"${@}"
279
}
280
281
# initialize a new bare repository
282
gib() { a__git_init_bare "${@}"; }
283
a__git_init_bare() {
284
git \
285
init \
286
--bare \
287
"${@}"
288
}
289
290
# log history
291
gl() { a__git_log "${@}"; }
292
a__git_log() {
293
git \
294
log \
295
--abbrev=8 \
296
--abbrev-commit \
297
--format="${RWX_GIT_LOG_FORMAT}" \
298
--graph \
299
"${@}"
300
}
301
302
# log all history
303
gla() { a__git_log_all "${@}"; }
304
a__git_log_all() {
305
a__git_log \
306
--all \
307
"${@}"
308
}
309
310
# log all history with patches
311
glap() { a__git_log_all_patch "${@}"; }
312
a__git_log_all_patch() {
313
a__git_log \
314
--all \
315
--patch \
316
"${@}"
317
}
318
319
# log history with patches
320
glp() { a__git_log_patch "${@}"; }
321
a__git_log_patch() {
322
a__git_log \
323
--patch \
324
"${@}"
325
}
326
327
# fast-forward merge to remote branch
328
gm() { a__git_merge "${@}"; }
329
a__git_merge() {
330
git \
331
merge \
332
--ff-only \
333
"${@}"
334
}
335
336
# abort the current merge commit
337
gma() { a__git_merge_abort "${@}"; }
338
a__git_merge_abort() {
339
git \
340
merge \
341
--abort \
342
"${@}"
343
}
344
345
# do a merge commit
346
gmc() { a__git_merge_commit "${@}"; }
347
a__git_merge_commit() {
348
git \
349
merge \
350
--no-ff \
351
--message \
352
"${@}"
353
}
354
355
# squash a branch and index its modifications
356
gms() { a__git_merge_squash "${@}"; }
357
a__git_merge_squash() {
358
git \
359
merge \
360
--squash \
361
"${@}"
362
}
363
364
# merge via external tool
365
gmt() { a__git_merge_tool "${@}"; }
366
a__git_merge_tool() {
367
git \
368
mergetool \
369
"${@}"
370
}
371
372
# push to the remote repository
373
gp() { a__git_push "${@}"; }
374
a__git_push() {
375
rwx_gpg_agent_update &&
376
git \
377
push \
378
--tags \
379
--verbose \
380
"${@}"
381
}
382
383
# delete from the remote repository
384
gpd() { a__git_push_delete "${@}"; }
385
a__git_push_delete() {
386
git \
387
push \
388
--delete \
389
"${@}"
390
}
391
392
# force the push to the remote repository
393
gpf() { a__git_push_force "${@}"; }
394
a__git_push_force() {
395
a__git_push \
396
--force \
397
"${@}"
398
}
399
400
# rebase current branch onto another
401
grb() { a__git_re_base "${@}"; }
402
a__git_re_base() {
403
git \
404
rebase \
405
"${@}"
406
}
407
408
# abort current rebase
409
grba() { a__git_re_base_abort "${@}"; }
410
a__git_re_base_abort() {
411
git \
412
rebase \
413
--abort \
414
"${@}"
415
}
416
417
# continue current rebase
418
grbc() { a__git_re_base_continue "${@}"; }
419
a__git_re_base_continue() {
420
git \
421
rebase \
422
--continue \
423
"${@}"
424
}
425
426
# force rebase without fast-forward
427
grbf() { a__git_re_base_force "${@}"; }
428
a__git_re_base_force() {
429
git \
430
rebase \
431
--force-rebase \
432
"${@}"
433
}
434
435
# rebase interactively
436
grbi() { a__git_re_base_interactive "${@}"; }
437
a__git_re_base_interactive() {
438
git \
439
rebase \
440
--interactive \
441
"${@}"
442
}
443
444
# add a new remote repository
445
grma() { a__git_re_mote_add "${@}"; }
446
a__git_re_mote_add() {
447
git \
448
remote \
449
add \
450
"${@}"
451
}
452
453
# list remote repositories
454
grml() { a__git_re_mote_list "${@}"; }
455
a__git_re_mote_list() {
456
git \
457
remote \
458
--verbose \
459
"${@}"
460
}
461
462
# set the location of a remote repository
463
grmsu() { a__git_re_mote_set_upstream "${@}"; }
464
a__git_re_mote_set_upstream() {
465
git \
466
remote \
467
set-url \
468
"${@}"
469
}
470
471
# show connection to a remote repository
472
grms() { a__git_re_mote_show "${@}"; }
473
a__git_re_mote_show() {
474
git \
475
remote \
476
show \
477
"${@}"
478
}
479
480
# remove and add removal to index
481
grm() { a__git_re_move "${@}"; }
482
a__git_re_move() {
483
git \
484
rm \
485
"${@}"
486
}
487
488
# remove file(s) from index or move current branch pointer
489
grs() { a__git_re_set "${@}"; }
490
a__git_re_set() {
491
git \
492
reset \
493
"${@}"
494
}
495
496
# wipe modifications or reset current branch to another commit
497
grsh() { a__git_re_set_hard "${@}"; }
498
a__git_re_set_hard() {
499
git \
500
reset \
501
--hard \
502
"${@}"
503
}
504
505
# show a commit
506
gsc() { a__git_show_commit "${@}"; }
507
a__git_show_commit() {
508
git \
509
show \
510
"${@}"
511
}
512
513
# current state of repository
514
gs() { a__git_status "${@}"; }
515
a__git_status() {
516
git \
517
status \
518
--untracked-files="all" \
519
"${@}"
520
}
521
522
# tag a commit
523
gt() { a__git_tag "${@}"; }
524
a__git_tag() {
525
git \
526
tag \
527
"${@}"
528
}
529
530
# delete a tag
531
gtd() { a__git_tag_delete "${@}"; }
532
a__git_tag_delete() {
533
git \
534
tag \
535
--delete \
536
"${@}"
537
}
538
539
# update head ref
540
gurh() { a__git_update_ref_head "${@}"; }
541
a__git_update_ref_head() {
542
if [ -n "${2}" ]; then
543
git \
544
update-ref \
545
"refs/heads/${1}" \
546
"${2}"
547
fi
548
}
549