-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathincludefile_gitconfig
77 lines (62 loc) · 2.29 KB
/
includefile_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
# This is *not* a complete git-config, but rather a set of "common" options that are *included* by my git-config.
#
# See also https://jvns.ca/blog/2024/02/16/popular-git-config-options/#merge-conflictstyle-zdiff3
# NEVER accidentally push feature branch to the trunk!
[push]
default = current
[merge]
conflictstyle = zdiff3
[init]
defaultBranch = main
# Make some commands colored
[color]
ui = true
# Woooooo
[help]
autocorrect = 1
# WOOOOOOOOOOOOOOOOO
[diff]
noprefix = true
tool = difftastic
# Note: this actually breaks `git diff -p`, in the sense that it no longer
# generates a valid patch. Womp womp
external = difft
[difftool]
prompt = false
[difftool "difftastic"]
cmd = difft "$LOCAL" "$REMOTE"
[pager]
difftool = true
[alias]
# Search aliases (from
# http://stackoverflow.com/documentation/git/337/aliases/1189/list-search-existing-aliases#t=201609141537078558661)
aliases = !git config --list | grep ^alias\\. | cut -c 7- | grep -Ei --color \"$1\" "#"
# TODO: consider using these: http://haacked.com/archive/2014/07/28/github-flow-aliases/
# Abort command if wrong number of args (expected # is first arg)
nargs = "!f () { \
num=$1 ; shift; test $# -eq $num ; \
res=$? ; \
if [ $res -ne 0 ]; then \
echo Wrong number of args! >&2; \
fi ;\
return $res ; } ; f"
# Current branch name
br = "rev-parse --abbrev-ref HEAD"
# Git dir (.git)
dir = "rev-parse --git-dir"
# Compare: list files changed from origin
cmp = "diff --name-status origin/master"
# Logging
lg0 = "log --color --graph --pretty=format:'%Cred%h%Creset \
-%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' \
--abbrev-commit"
lg1 = "log --graph --abbrev-commit --decorate --date=relative \
--format=format:'%C(bold blue)%h%C(reset) - \
%C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- \
%an%C(reset)%C(bold yellow)%d%C(reset)' --all"
lg2 = "log --graph --abbrev-commit --decorate \
--format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) \
%C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' \
%C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all"
# Must use ! for meta-alias
lg = "!git lg1"