-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitconfig
136 lines (125 loc) · 3.68 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
[user]
name = Yann Thomas-Gérard
email = [email protected]
[color]
diff = auto
status = auto
branch = auto
ui = true
[core]
pager = diff-so-fancy | less --tabs=4 -RFX
excludesfile = ~/.gitignore_global
[alias]
cp = cherry-pick
a = number add
d = number diff
dc = number diff --cached
; r = number rm
unstage = number reset HEAD
; e = edit
e = number -c vim
; run any git command, for example:
; git n add 1
n = number
; this allows commands such as:
; git nc cat 1
; => execute cat on the first numbered file
nc = number -c
g = grep
; Push the branch you are on to the remote
p = push origin HEAD
pn = push origin HEAD --no-verify
pfw = push origin HEAD --force-with-lease
pnfw = push origin HEAD --force-with-lease --no-verify
l = log
lo = log --pretty=oneline
lp = log -p
lg = log --graph --pretty=tformat:'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%an %ar)%Creset'
sl = log --pretty=tformat:'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%an %ar)%Creset'
lpe = log -p -- . ":(exclude)*package-lock.json"
; s = status --short
s = number -s
; st = status
st = number
br = branch
co = number checkout
ci = commit
ca = commit -a
caa = commit -a --amend
caan = commit -a --amend --no-edit
ru = remote update
prom = pull --rebase origin master
rcont = rebase --continue
c = clone
; Checkout branch name from master
cob = "!f() {\
if [ -z \"$1\" ];\
then\
echo \"Usage: git cob branch_name\";\
return;\
fi;\
git checkout -b "$1" origin/master;\
}; f"
rauthor = "!f() {\
name=$(git config --get user.name);\
email=$(git config --get user.email);\
git commit --amend --author=\"$name <$email>\";\
}; f"
; Fetch git objects and reset hard to master
rhard = "!git fetch origin && git reset --hard origin/master"
rh = "reset --hard"
; Edit modified file
edit = "!vim `git diff --name-only`"
staged = "!vim `git diff --name-only --cached`"
all = "!vim `git diff --name-only HEAD`"
flog = number log --name-status
f = fetch --prune
cpr = pull-request
prco = pr checkout
; fuzzy pr checkout
prcof = "!hub pr list |\
fzf |\
sed -E 's/^\\s+#([0-9]+).*/\\1/' |\
xargs --no-run-if-empty --verbose hub pr checkout"
reuse = commit -eF .git/COMMIT_EDITMSG
cz = !./node_modules/.bin/git-cz
cleanup = "!git branch --merged | grep -v '\\*\\|master\\|develop' | xargs -n 1 git branch -d"
bi = bisect
brshort = branch --format='%(refname:short)'
; fuzzy checkout a local branch
cof = "!git brshort | fzf | xargs --no-run-if-empty --verbose git checkout"
; fuzzy checkout a remote branch
corf = "!git brshort --remotes |\
fzf |\
sed -E 's#^origin/([[:alnum:]_-]+)$#\\1 origin/\\1#' |\
xargs --no-run-if-empty --verbose git checkout -b"
; fuzzy add files
af = "!git ls-files -m -o --exclude-standard |\
fzf --print0 -m --preview 'git diff {}' --preview-window=top:10:wrap |\
xargs -0 -t -o git add --all"
; fuzzy edit edited files
ef = !FILES=`git diff --name-only | fzf --multi` && vim ${FILES}
[rerere]
enabled = true
[merge]
tool = vimdiff
[mergetool]
prompt = false
[push]
default = simple
[color "diff-highlight"]
oldNormal = red bold
oldHighlight = red bold 52
newNormal = green bold
newHighlight = green bold 22
[color "diff"]
meta = 11
frag = magenta bold
commit = yellow bold
old = red bold
new = green bold
whitespace = red reverse
[diff]
tool = vimdiff
[gitreview]
remote = origin