dotfiles/.config/git/config

184 lines
5.5 KiB
Plaintext

[core]
autocrlf = input
editor = nvim
pager = diffr --colors refine-added:none:background:0x33,0x66,0x33:bold --colors added:none:background:0x33,0x44,0x33 --colors refine-removed:none:background:0x66,0x33,0x33:bold --colors removed:none:background:0x44,0x33,0x33 | less --RAW-CONTROL-CHARS --quit-on-intr
hooksPath = .dev/githooks
[interactive]
diffFilter = diffr --colors refine-added:none:background:0x33,0x66,0x33:bold --colors added:none:background:0x33,0x44,0x33 --colors refine-removed:none:background:0x66,0x33,0x33:bold --colors removed:none:background:0x44,0x33,0x33
[submodule]
recurse = true
[rerere]
enabled = true
# Parallelize
[pack]
threads = 0
[checkout]
workers = 0
[fetch]
parallel = 0
[submodule]
fetchJobs = 0
[pull]
ff = only
[checkout]
defaultRemote = origin
[init]
defaultBranch = main
[diff]
tool = nvim
submodule = log
context = 2
[merge]
tool = nvim
[mergetool "nvim"]
cmd = nvim -f -c \"Gdiffsplit!\" \"$MERGED\"
prompt = false
[difftool "nvim"]
cmd = "nvim -d \"$LOCAL\" \"$REMOTE\""
# Automatically push to branch with matching name
[push]
default = current
[status]
showStash = true
# Disable pagination for branch commmand by default
[pager]
branch = false
[grep]
lineNumber = true
[log]
date=local
[color "status"]
added = green
changed = yellow
untracked = magenta
[user]
email = 27jf@pm.me
name = xeruf
[mailmap]
file = /home/janek/.config/yadm/.mailmap
[http]
lowSpeedLimit = 1000
lowSpeedTime = 3
[url "ssh://github.com/"]
pushInsteadOf = https://github.com/
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[alias]
fzf = !fzf --preview='git diff HEAD --color=always -- {}' --tiebreak=end,index --multi
fzs = !cut -z -c2- | git fzf --read0 -d' ' --nth=2.. --bind='alt-enter:execute(nvim {2..})' --preview='test {1} != \\? && git diff --color HEAD -- {2..} | $(git config interactive.diffFilter) || find {2..} -type f | xargs -I% diff --recursive --color=always -u /dev/null %' | cut -c3-
# GET INFO
s = !git stl && git stb
st = stb .
stb = status --short --branch
sv = --paginate status -v
svv = --paginate status -vv
r = remote -v
b = branch -vv
ba = b -a
main = !cat "$(git rev-parse --git-path refs/remotes/origin/HEAD)" | cut -d'/' -f4
sw = switch
sc = switch -c
sd = switch -d
sm = !git switch $(git main)
find = log --patch --all --full-history
ref = reflog show --pretty=tformat:'%C(auto)%h%d %s %Cgreen(%cd) %Cblue<%an>%Creset'
hf = log --patch --follow --find-renames=1 --
rev = rev-parse --short
head = rev-parse --short HEAD
root = rev-parse --show-toplevel
dir = rev-parse --git-dir
curbranch = symbolic-ref --short HEAD
upstream = !git rev-parse --abbrev-ref --symbolic-full-name @{upstream} || git rev-parse --abbrev-ref --symbolic-full-name @{push} || echo origin/$(git curbranch)
lgr = log --pretty=tformat:'%C(auto)%h%d %s %Cgreen(%cd) %Cblue<%an>%Creset' --date=human --graph
lg = lgr HEAD @{push}
lo = log --pretty=tformat:'%C(auto)%h%d %s %Cgreen(%cd) %Cblue<%an>%Creset' --date=human --no-merges
lp = log -p --date=local
my = lo --author [Jj]anek
standup = my --since yesterday --all
co-authors = !git log | grep -i Co-Authored | awk '!a[$0]++'
when = !git for-each-ref --sort=committerdate --format='%(refname:short) * %(authorname) * %(committerdate:relative)' refs/remotes/ # List all branches with their last updates
d = diff
dm = !git diff $(git merge-base $(git main) HEAD)
dw = diff --color-words
dc = diff --color-words="[^[:space:]]|([[:alnum:]]|UTF_8_GUARD)+"
du = diff @{push}
# MODIFY
# Local Changes
a = add -u
aa = add -u .
ap = add -p
af = !git status --porcelain --no-renames --untracked-files=all -z | grep -v '^\\w ' -z | git fzs | git -c advice.addEmptyPathspec=false add --verbose --pathspec-from-file=-
sf = "!git status --porcelain --no-renames -z | sed -z 's/^\\(\\w\\) / \\1/' | git fzs >/tmp/git-sf && git -c advice.addEmptyPathspec=false add --intent-to-add --pathspec-from-file=/tmp/git-sf; git commit --only -v --pathspec-from-file=/tmp/git-sf"
c = commit -v
cad = !git diff-tree --no-commit-id --name-only -r HEAD | git commit -v --amend --pathspec-from-file=- # Amend commit with all already changed files
cme = commit -v --edit --message # Commit with message but edit it
cp = cherry-pick
rb = rebase
rbi = rebase --interactive
rbc = rebase --continue
rbu = rebase @{upstream}
rbm = !git rebase $(git main)
sta = stash
stl = !git --no-pager stash list --pretty=tformat:'%gd%h - %s (%cr)'
sts = stash show -v
stp = stash pop
std = !git stash drop && git stl
rh = reset HEAD~
rs = reset --keep
rsu = reset --keep @{upstream}
unstage = restore --staged --
recover = restore --worktree --staged --
format-head = !git stash && git-clang-format HEAD~ && git commit -a --amend --no-edit && git stash pop
sun = submodule update --no-fetch
# Update from remote
su = submodule update --init --recursive
f = fetch
fa = fetch --all
fs = !git fetch && git st
lu = !git pull upstream ${1:-$(git curbranch)}
rg = rmgonebranches
gcr = !git gc && git repack -a -d
# Change remote
ruu = !git fetch upstream && git reset --keep upstream/${1:-$(git curbranch)} && git push --no-verify --force-with-lease
luu = !git pull upstream ${1:-$(git curbranch)} && git push --no-verify
pf = push --force-with-lease
cap = !git commit --amend --no-edit && git push --force-with-lease
[includeIf "gitdir:yadm/repo.git"]
path = "~/.config/yadm/gitconfig"
[includeIf "gitdir:~/data/.git"]
path = "config-data"