-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitconfig
150 lines (127 loc) · 6.42 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
[user]
name = Tubbles
email = jae91m@gmail.com
[core]
# editor = 'C:/Tools/Notepad++ 7.2.2/notepad++.exe' -multiInst -notabbar -nosession
editor = hx
excludesfile = $HOME/.gitignore_global
preloadindex = true
fscache = true
whitespace = space-before-tab,tab-in-indent,trailing-space,cr-at-eol,tabwidth=4
pager = less -x1,5
[push]
default = simple
autoSetupRemote = true
[alias]
# alias - Show all available git aliases
alias = !git config --list | grep alias | sed 's/\\./ /g'
# authors - Count the commit authors
authors = shortlog -s -n --all --no-merges
# Various log aliases
flog = log --graph --decorate --date=iso
lol = log --no-show-signature --graph --format='%C(yellow)%h %C(cyan)%<(12,trunc)%an %C(red)%ad %C(auto)%d %Creset%<(80,trunc)%s' --date=iso
llol = !git for-each-ref --format='%(refname:short)' refs/heads/ | paste -sd' ' | xargs git lol --no-show-signature
# tlol = tag --color --sort -authordate --format='%(align:width=65)%(color:cyan)%(refname:short)%(end) %(align:width=80)%(color:white)%(contents:subject)%(end) %(color:yellow)%(taggerdate:short) %(color:red)%(taggername)'
tlol = tag --color --sort -taggerdate --format='%(align:left,92)%(color:bold red)%(refname:short)%(end)%(color:nobold yellow)%(objectname:short) %(if)%(taggername)%(then)%(else)%(color:default)* %(end)%(align:left,20)%(color:cyan)%(if)%(taggername)%(then)%(taggername)%(else)%(authorname)%(end)%(end) %(align:left,30)%(color:red)%(if)%(taggerdate:iso)%(then)%(taggerdate:iso)%(else)%(authordate:iso)%(end)%(end) %(color:default)%(subject)'
blol = branch -r --color --sort -authordate --format=' %(align:left,92)%(color:bold red)%(refname:short)%(end)%(color:nobold yellow)%(objectname:short) %(align:left,20)%(color:cyan)%(authorname)%(end) %(align:left,30)%(color:red)%(authordate:iso)%(end) %(color:default)%(subject)'
# jshow - Display what files only changed
jshow = show --name-only
# mshow, jmshow - Display what changed for a merge commit, or only the files
mshow = "!f() { git show \"${1:-HEAD}\" | grep ^Merge | sed -E 's/^Merge: ([0-9a-fA-F]+) ([0-9a-fA-F]+)/\\2..\\1/g' | xargs git diff; }; f"
jmshow = "!f() { git show \"${1:-HEAD}\" | grep ^Merge | sed -E 's/^Merge: ([0-9a-fA-F]+) ([0-9a-fA-F]+)/\\2..\\1/g' | xargs git diff --name-only; }; f"
# readd, rediff - handle changes to already staged files
readd = !git -c color.status=never status --short | grep '^[MARC][MD]' | awk '{ print $NF }' | tee /dev/tty | xargs git add 2>&1 | sed -E '/.*(Nothing|Maybe).*/d'
rediff = !git -c color.status=never status --short | grep '^[MARC][MD]' | awk '{ print $NF }' | xargs --no-run-if-empty git diff --ws-error-highlight=all --
# amend - commit amend without edit
amend = commit --amend --no-edit
# drop, udrop, bdrop - drop non-staged changes and gone branches (Potentially dangerous)
drop = "!f() { if [ -n \"$1\" ]; then git checkout -- \"$@\" ; else git checkout -- . ; fi }; f"
udrop = !git status --porcelain | grep '^??' | cut -c 4- | tee /dev/tty | xargs -i rm -fr "{}"
bdrop = !git branch -vv | grep ': gone]' | grep -v '^*' | awk '{print $1}' | xargs --no-run-if-empty git branch -D
# nuke, drop-nuke - clean the repo
nuke = clean -dffX
drop-nuke = !git drop && git clean -dffx
# back - display files that have changed in remote since last pull
back = !git show --name-status HEAD..origin/HEAD --pretty="" | sort | uniq
# ll, jst - display working tree status
ll = status --porcelain --ignored
jst = !git -c color.status=always status -s | less -FRX
# conflict - Display what our current conflicts are, during a merge
conflict = !git status -s | grep -E '^(.U|U.)' | awk '{print $2}' | xargs grep -Hn -E '(<<<<<<<|=======|>>>>>>>)'
# fix - Display what our current conflicts are, during a merge, using vscode
fix = !git diff --check 2>&1 | grep conflict | awk -F':' '{print $1}' | sort -u | xargs --no-run-if-empty code
# file-log - display a log of history for a file, even through renames
file-log = log -p --follow
# jdiff - display a per-character diff instead of the ordinary per-line
jdiff = diff --color-words=.
jdiff2 = diff --color-words='[^[:space:]]|([[:alnum:]]|UTF_8_GUARD)+'
# all - shows all history since the null tree (empty tree)
all = !git show "$(git hash-object -t tree /dev/null)"..
# Japanese flavoured alias
# Use this together with the git stash, short for git stash push
# If git stash pop does not exist, it can be replaced by a git stash apply
# followed by a git stash drop.
jpop = stash pop --index
# Display all children of a commit
children = "!f() { git rev-list --all --not $1^@ --children | grep $(git rev-parse $1); }; f"
# List current feature branch
topic = !git lol --not origin/`git remote show origin | grep \"HEAD branch\" | awk '{print $NF}'` --not `git branch --show` origin/`git branch --show`
# List all local and their corresponding remote tracking branches
local = !git lol HEAD `git branch -vv | cut -c3- | sed 's/ \\[/\\n/g' | grep -v -e 'HEAD detached' -e ': gone]' | awk -F'[\\\\\\] :]' '{print $1}' | paste -sd' '`
# "Force merge"
force-merge = !git reset --hard `git rev-parse --abbrev-ref --symbolic-full-name @{u}`
# "Force pull"
force-pull = !git fetch -ap && git force-merge
[color "status"]
untracked = magenta
changed = cyan
[color]
diff = auto
status = auto
branch = auto
interactive = auto
ui = true
pager = true
[color.diff]
oldMoved = "red bold"
newMoved = blue
oldMovedAlternative = magenta
newMovedAlternative = cyan
[gc]
auto = 256
[diff]
wsErrorHighlight = all
colorMoved = default
[blame]
coloring = highlightRecent
[pager]
log = diff-highlight | less -NMRX
show = diff-highlight | less -NMRX
diff = diff-highlight | less -NMRX
[interactive]
diffFilter = diff-highlight
[merge]
defaultToUpstream = true
[init]
defaultBranch = main
[format]
pretty = fuller
[log]
showSignature = true
follow = true
date = iso # shows relative timestamps thanks to git+ssh://git@github.com:Tubbles/git.git#main
[reset]
quiet = true
[fetch]
prune = true
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[credential]
helper = store
[rerere]
enabled = true
[include]
path = ~/.gitconfig_extra