-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgitconfig
94 lines (89 loc) · 3.04 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
# ==================== Dev env ====================
[includeIf "gitdir:~/projects/"]
path = .gitconfig-work.config
[includeIf "gitdir:~/dotfiles/"]
path = .gitconfig-dev.config
[includeIf "gitdir:~/other_projects/"]
path = .gitconfig-dev.config
# ==================== Misc ====================
[core]
attributesfile = ~/.gitattributes
editor = nvim
excludesfile = /Users/user/.gitignore_global
pager = delta
[init]
defaultBranch = main
[commit]
template = ~/.stCommitMsg
[fetch]
prune = true
[pull]
rebase = true
[rerere]
enabled = true
# ==================== Merge ====================
[merge]
tool = nvim
[mergetool "nvim"]
cmd = nvim -c \"Gvdiffsplit!\" -f \"$MERGED\"
trustExitCode = true
[mergetool]
prompt = false
keepBackup = false
# ==================== Diff ====================
[diff]
algorithm = histogram
colorMoved = zebra
[interactive]
diffFilter = delta --color-only --features=interactive
[delta]
line-numbers = true
navigate = true
syntax-theme = OneHalfDark
[color "diff"]
# Using the background from: delta --show-config | grep style
oldMoved = italic brightmagenta "#3f0001"
newMoved = italic brightblue "#002800"
oldMovedAlternative = italic brightmagenta "#3f0001"
newMovedAlternative = italic brightblue "#002800"
# source: https://juripakaste.fi/swift-git-attributes/
[diff "swift"]
xfuncname = ^[ \t]*(((private |public |internal |final |open )*class|(private |public |internal )*struct|(private |public |internal )*actor|(private |public |internal )*func|(private |public |internal )*extension|(private |public |internal )*enum)[ \t].*)$
[alias]
# ==================== Shortcuts ====================
a = add
aa = add --all
ap = add -p
b = branch
ba = branch -a
co = checkout
d = diff
dc = diff --cached
com = commit --verbose
coma = commit --verbose --amend --no-edit
comf = commit --verbose --fixup=HEAD
conf = diff --name-only --diff-filter=U
last = log -p -1
last-msg = !git --no-pager log --format=format:%B -1
pul = pull
punch = push --force-with-lease
s = status -sb
unstage = reset --
undo = reset --soft HEAD^
# ==================== Custom ====================
alias = !git config --list | grep 'alias\\.' | sed 's/alias\\.\\([^=]*\\)=\\(.*\\)/\\1\\t=> \\2/' | sort
go = "!gitgo"
ignore = "!f() { echo $1 >> .gitignore; }; f"
ignored = ! git ls-files --others --ignored --exclude-standard --directory && git ls-files --others -i --exclude-standard
prune-branches = "!f() { git branch --merged ${1:-main} | grep -v main | grep -v develop | grep -v master | xargs git branch -d; }; f"
this = !git init && git add . && git commit -m \"Initial commit\"
# ==================== Unwatch ====================
unwatch = update-index --assume-unchanged
unwatched = "!git ls-files -v | grep '^[[:lower:]]'"
watch = update-index --no-assume-unchanged
watchall = "!git unwatched | xargs -L 1 -I % sh -c 'git watch `echo % | cut -c 2-`'"
[filter "lfs"]
process = git-lfs filter-process
required = true
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f