dotfiles/.config/git/config

203 lines
5.2 KiB
Plaintext

[core]
autocrlf = input
editor = nvim
hooksPath = .dev/githooks
[submodule]
recurse = true
[rerere]
enabled = true
# Parallelize
[pack]
threads = 0
[checkout]
workers = 0
[fetch]
parallel = 0
[submodule]
fetchJobs = 0
# Create & Sync
[pull]
ff = only
[checkout]
defaultRemote = origin
[init]
defaultBranch = main
[push]
default = current # Automatically push to branch with matching name
recurseSubmodules = on-demand
# Editor
[diff]
tool = nvim
submodule = log
context = 2
renames = true
colorMoved = dimmed-zebra
colorMovedWS = allow-indentation-change
[merge]
renames = copy
tool = nvim
[mergetool "nvim"]
cmd = nvim -f -c \"Gdiffsplit!\" \"$MERGED\"
prompt = false
[difftool "nvim"]
cmd = "nvim -d \"$LOCAL\" \"$REMOTE\""
[pager]
branch = false # Disable pagination for branch list
[status]
showStash
[grep]
lineNumber
[log]
date=local
follow
[commit]
verbose
[color "status"]
added = green
changed = yellow
untracked = magenta
[user]
email = 27jf@pm.me
name = xeruf
[mailmap]
file = /home/janek/.config/yadm/.mailmap
[http]
lowSpeedLimit = 100
lowSpeedTime = 10
[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]
# GET INFO
# status
s = !git stl && git stb
st = stb .
stb = status --short --branch --find-renames
sv = --paginate status -v
svv = --paginate status -vv
tl = !git ls-tree --full-tree --name-only -r HEAD | tree -C --fromfile . | ${PAGER:-less}
tree = !git ls-tree --name-only -r HEAD | tree -C --fromfile . | ${PAGER:-less}
# repo
r = remote -v
b = branch -vv
ba = b -a
main = !git rev-parse --abbrev-ref origin/HEAD | cut -d'/' -f2
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)
rev = rev-parse --short
head = rev-parse --short HEAD
root = rev-parse --show-toplevel
dir = rev-parse --git-dir
# history
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 # Like --full-diff
my = lo --author "xeru\\|anek\\|melonion"
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
tags = !git for-each-ref --color=always --format='%(color:yellow)%(tag)%(color:default)%09 %(subject) %(color:green)(%(taggerdate:format:%Y-%m-%d))' refs/tags | sort -V | column -s $'\t' -t
find = log --patch --all --full-history # Find a filename in all git knows
ref = reflog show --pretty=tformat:'%C(auto)%h%d %s %Cgreen(%cd) %Cblue<%an>%Creset'
refg = log --reflog --graph --pretty=tformat:'%C(auto)%h%d %s %Cgreen(%cd) %Cblue<%an>%Creset'
history = log --patch --follow --find-renames=1 -- # Show the history of the given file
# diffs
d = diff
dm = !git diff $(git merge-base $(git main) HEAD) # [d]iff to [m]ain
dw = diff --color-words # [d]iff [w]ords
dc = diff --color-words="[^[:space:]]|([[:alnum:]]|UTF_8_GUARD)+" # [d]iff [c]haracters
du = diff @{push} # [d]iff [u]pstream
# MODIFY
sw = switch
sc = switch -c
sd = switch -d
sm = !git switch $(git main)
# Local Changes
a = add -u
aa = add -u .
ap = add -p
c = commit -v
cme = commit -v --edit --message # Commit with message from CLI but edit it
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
cap = !git commit --amend --no-edit && git push --force-with-lease
journal = !command git -C $DATA commit -v $DATA/2-box/journal*
cp = cherry-pick
cpc = cherry-pick --continue
rb = rebase
rbi = rebase --interactive
rbc = rebase --continue
rbu = rebase @{upstream} --autostash
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
# Fetch
su = submodule update --init --recursive
f = fetch
fa = fetch --all
fs = !git fetch && git st
lr = pull --rebase
lu = !git pull --rebase upstream ${1:-$(git curbranch)}
# Push
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
pu = push --set-upstream
# CLEANUP
gcr = !git gc && git repack -a -d
# see git-prunerefs
[include]
path= "diffr"
[includeIf "gitdir:yadm/repo.git"]
path = "~/.config/yadm/gitconfig"
[safe]
directory = /opt/flutter
[credential]
helper = cache --timeout 1000