-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitconfig
117 lines (117 loc) · 5.95 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
[user]
name = Ralf Vogler
email = ralf.vogler@gmail.com
username = vogler
[credential]
# set via `sudo git credential-manager configure --system`
# auth via `git credential-manager github login`
# helper = /usr/local/share/gcm-core/git-credential-manager
# helper = osxkeychain # only macOS, requires creating a personal access token
# helper = cache --timeout=604800 # 7 days in memory
# Set this using `git config --system --add credential.helper ...` since I want keychain on macos but on other ssh linux boxes I'm stuck with cache (store is plaintext), and this global config would overwrite the system one.
[credential "https://github.com"]
username = vogler
[credential "https://bitbucket.org"]
username = vogler
[credential "https://versioncontrolseidl.in.tum.de"]
username = vogler
[credential "https://gitlab.lrz.de"]
username = gu95foc
[github]
user = vogler
[hub] # https://hub.github.com - newer: https://cli.github.com
# protocol = https
[core]
editor = nvim
excludesfile = ~/.gitignore_global
autocrlf = input
safecrlf = true
ignorecase = true
# pager = diff-so-fancy | less --tabs=4 -RFX --pattern='^(added|deleted|modified): '
# less options:
# -+S Wrap lines instead of the default chop-long-lines which breaks mouse select & copy in terminal (also, horizontal scrolling is annoying).
# -F Quit if entire file fits on first screen. Otherwise have to press q.
# -E Quit at end of file. E.g. when reaching it via G.
# -R Output "raw" control characters.
# -X Don't use init/deinit strings.
pager = delta # also set individually below
# setting options in DELTA_PAGER in ~/.zshenv such that they're also used when using delta for rg etc.
[pager]
# diff = diff-so-fancy | less --tabs=4 -RFX --pattern='^(added|deleted|modified): ' # the problem with this is that it also jumps directly to the first match and fills rest of screen with ~ for empty lines.
diff = diff-so-fancy | less --tabs=4 -RXFE -+S
# log = diff-so-fancy | less --tabs=4 -RFX --pattern='^Commit: '
log = diff-so-fancy | less --tabs=4 -RFX -+S
show = diff-so-fancy | less --tabs=4 -RXFE -+S
# use delta instead of diff-so-fancy for syntax highlighting and more: https://github.com/dandavison/delta
diff = delta
log = delta
show = delta
blame = delta
reflog = delta
[delta]
syntax-theme = Solarized (dark)
# line-numbers = true
# side-by-side = true
navigate = true # use n and N to move between diff sections
hyperlinks = true # iTerm will also open files on cmd+click without this, but this will add proper links for commits, line numbers (also in rgd for search) etc.
# from https://dandavison.github.io/delta/grep.html
# by default opens in VimR, but line numbers did not work, so using vscode instead:
hyperlinks-file-link-format = "vscode://file/{path}:{line}"
[delta "decorations"]
# file-style = omit
# file-style = bold yellow ul
# file-decoration-style = none
hunk-header-decoration-style = yellow box
# hunk-header-file-style = red
hunk-header-line-number-style = yellow
# hunk-header-style = file line-number syntax
[interactive]
singleKey = true
# diffFilter = diff-so-fancy --patch # since 1.4.0, https://github.com/so-fancy/diff-so-fancy/issues/35#issuecomment-776870877
diffFilter = delta --color-only --features=interactive
[delta "interactive"]
keep-plus-minus-markers = false
[color]
ui = auto
[init]
defaultBranch = main
[push]
default = current
[pull]
rebase = true
[rebase]
autostash = true
[diff]
compactionHeuristic = true # https://github.blog/2016-06-13-git-2-9-has-been-released/#beautiful-diffs
submodule = log
indentHeuristic = true
colorMoved = default
[merge]
tool = nvim # vimdiff; https://www.grzegorowski.com/using-vim-or-neovim-nvim-as-a-git-mergetool
[mergetool "nvim"]
cmd = nvim -f -c \"Gvdiffsplit!\" \"$MERGED\"
[mergetool]
prompt = false
[submodule]
fetchJobs = 0
#This will add the fixup command to git
#git fixup $commit will use your current index to fixup the specified commit
#This is done by doing git commit --fixup $commit and then using rebase with autosquash
#Based upon http://stackoverflow.com/a/21148981/460564
[alias]
fixup = "!sh -c '(git diff-files --quiet || (echo Unstaged changes, please commit or stash with --keep-index; exit 1)) && COMMIT=$(git rev-parse $1) && git commit --fixup=$COMMIT && git rebase -i --autosquash $COMMIT~1' -"
root = !pwd
exec = "!exec "
stash-rename = "!_() { rev=$(git rev-parse $1) && git stash drop $1 || exit 1 ; git stash store -m \"$2\" $rev; }; _"
jump = !/usr/local/opt/git/share/git-core/contrib/git-jump/git-jump
bwd = !git checkout HEAD^
fwd = !git log --reverse --pretty=%H master | grep -A 1 $(git rev-parse HEAD) | tail -n1 | xargs git checkout
addnw=!sh -c 'git diff -U0 -w --no-color "$@" | git apply --cached --ignore-whitespace --unidiff-zero -'
branchr=branch --sort=-committerdate --format='%(HEAD) %(color:blue)%(refname:short)%(color:reset) %(color:green)%(committerdate:relative)%(color:reset) %(color:yellow)%(authorname)%(color:reset)\n %(contents:subject)\n' # instead of `brew install git-recent`, this also accepts options for git branch like -a, edited from https://stackoverflow.com/questions/5188320/how-can-i-get-a-list-of-git-branches-ordered-by-most-recent-commit
# https://stackoverflow.com/questions/3161204/how-to-find-the-nearest-parent-of-a-git-branch
parent = "!git show-branch | grep '*' | grep -v \"$(git rev-parse --abbrev-ref HEAD)\" | head -n1 | sed 's/.*\\[\\(.*\\)\\].*/\\1/' | sed 's/[\\^~].*//' #"
# https://difftastic.wilfred.me.uk/git.html
dft = "!f() { GIT_EXTERNAL_DIFF=difft git diff $@; }; f" # `git diff` with difftastic.
dlog = "!f() { : git log ; GIT_EXTERNAL_DIFF=difft git log -p --ext-diff $@; }; f" # `git dlog` to show `git log -p` with difftastic.
[credential "https://dev.azure.com"]
useHttpPath = true