dotfiles/.config/git/config

200 lines
5.1 KiB
Plaintext
Raw Normal View History

2020-03-08 18:58:52 +00:00
[core]
autocrlf = input
editor = nvim
2021-07-20 15:21:27 +00:00
hooksPath = .dev/githooks
2020-03-31 20:32:43 +00:00
[submodule]
recurse = true
[rerere]
enabled = true
2021-07-04 18:00:51 +00:00
# Parallelize
2020-03-31 20:32:43 +00:00
[pack]
threads = 0
2021-07-04 18:00:51 +00:00
[checkout]
workers = 0
[fetch]
parallel = 0
[submodule]
fetchJobs = 0
2020-03-31 20:32:43 +00:00
2022-02-11 10:45:12 +00:00
# Create & Sync
[pull]
ff = only
[checkout]
defaultRemote = origin
[init]
defaultBranch = main
2022-02-11 10:45:12 +00:00
[push]
default = current # Automatically push to branch with matching name
2022-02-11 10:45:12 +00:00
# Editor
2020-06-03 10:26:15 +00:00
[diff]
tool = nvim
submodule = log
context = 2
2022-09-03 11:36:52 +00:00
renames = copy
colorMoved = dimmed-zebra
colorMovedWS = allow-indentation-change
2020-06-03 10:26:15 +00:00
[merge]
tool = nvim
[mergetool "nvim"]
cmd = nvim -f -c \"Gdiffsplit!\" \"$MERGED\"
prompt = false
[difftool "nvim"]
cmd = "nvim -d \"$LOCAL\" \"$REMOTE\""
2020-06-03 10:26:15 +00:00
2020-03-08 18:58:52 +00:00
[pager]
2022-02-11 10:45:12 +00:00
branch = false # Disable pagination for branch list
[status]
showStash
2020-03-31 20:32:43 +00:00
[grep]
lineNumber
2021-04-11 20:47:51 +00:00
[log]
date=local
follow
2022-02-11 10:45:12 +00:00
[commit]
verbose
2020-03-31 20:32:43 +00:00
2020-03-08 18:58:52 +00:00
[color "status"]
added = green
changed = yellow
2020-03-31 20:32:43 +00:00
untracked = magenta
[user]
email = 27jf@pm.me
name = xeruf
2020-03-31 20:32:43 +00:00
[mailmap]
file = /home/janek/.config/yadm/.mailmap
[http]
2021-11-11 18:45:50 +00:00
lowSpeedLimit = 100
lowSpeedTime = 10
2021-01-27 10:26:24 +00:00
[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
2020-03-08 18:58:52 +00:00
[alias]
2020-12-12 15:51:14 +00:00
# GET INFO
# status
2021-05-05 06:47:29 +00:00
s = !git stl && git stb
st = stb .
stb = status --short --branch --find-renames=.2
2021-05-20 10:16:20 +00:00
sv = --paginate status -v
svv = --paginate status -vv
2021-11-09 04:37:07 +00:00
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
2020-12-07 20:55:25 +00:00
ba = b -a
main = !cat "$(git rev-parse --git-path refs/remotes/origin/HEAD)" | cut -d'/' -f4
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)
2021-07-17 20:48:33 +00:00
rev = rev-parse --short
head = rev-parse --short HEAD
2020-03-08 18:58:52 +00:00
root = rev-parse --show-toplevel
dir = rev-parse --git-dir
2020-10-23 12:02:54 +00:00
# history
2021-10-08 10:26:22 +00:00
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
2024-01-12 16:53:07 +00:00
my = lo --author "xeru\\|anek\\|melonion"
2021-04-11 20:47:51 +00:00
standup = my --since yesterday --all
co-authors = !git log | grep -i Co-Authored | awk '!a[$0]++'
2021-06-23 15:23:28 +00:00
when = !git for-each-ref --sort=committerdate --format='%(refname:short) * %(authorname) * %(committerdate:relative)' refs/remotes/ # List all branches with their last updates
2024-01-12 16:53:07 +00:00
tags = !sh -c "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"
2022-06-22 16:37:27 +00:00
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'
2022-06-22 16:37:27 +00:00
history = log --patch --follow --find-renames=1 -- # Show the history of the given file
# diffs
2021-01-11 11:27:55 +00:00
d = diff
2022-08-21 10:29:51 +00:00
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
2021-01-11 11:27:55 +00:00
# MODIFY
sw = switch
sc = switch -c
sd = switch -d
sm = !git switch $(git main)
2020-12-12 15:51:14 +00:00
# Local Changes
a = add -u
aa = add -u .
2020-10-03 09:37:54 +00:00
ap = add -p
2020-10-03 09:37:54 +00:00
c = commit -v
2023-10-04 15:17:06 +00:00
cme = commit -v --edit --message # Commit with message from CLI but edit it
2021-06-23 15:23:28 +00:00
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
2023-10-04 15:17:06 +00:00
cap = !git commit --amend --no-edit && git push --force-with-lease
2023-11-04 18:12:48 +00:00
journal = !git -C $DATA commit -v $DATA/2-box/journal*
2020-12-12 15:51:14 +00:00
cp = cherry-pick
2021-11-19 11:01:04 +00:00
cpc = cherry-pick --continue
2021-05-06 06:29:05 +00:00
rb = rebase
rbi = rebase --interactive
rbc = rebase --continue
2021-11-23 14:36:24 +00:00
rbu = rebase @{upstream} --autostash
2021-06-23 15:23:28 +00:00
rbm = !git rebase $(git main)
2020-12-12 15:51:14 +00:00
sta = stash
2021-05-05 06:47:29 +00:00
stl = !git --no-pager stash list --pretty=tformat:'%gd%h - %s (%cr)'
2020-12-12 15:51:14 +00:00
sts = stash show -v
stp = stash pop
2021-05-05 06:47:29 +00:00
std = !git stash drop && git stl
rh = reset HEAD~
rs = reset --keep
rsu = reset --keep @{upstream}
2021-03-25 09:27:44 +00:00
unstage = restore --staged --
recover = restore --worktree --staged --
2020-12-10 16:34:56 +00:00
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
2020-12-12 15:51:14 +00:00
f = fetch
fa = fetch --all
fs = !git fetch && git st
2021-11-06 22:26:22 +00:00
lr = pull --rebase
lu = !git pull --rebase upstream ${1:-$(git curbranch)}
2020-12-12 15:51:14 +00:00
# Push
2021-04-21 17:51:14 +00:00
ruu = !git fetch upstream && git reset --keep upstream/${1:-$(git curbranch)} && git push --no-verify --force-with-lease
2021-09-18 20:05:23 +00:00
luu = !git pull upstream ${1:-$(git curbranch)} && git push --no-verify
2020-12-12 15:51:14 +00:00
pf = push --force-with-lease
# CLEANUP
gcr = !git gc && git repack -a -d
2022-09-03 11:36:52 +00:00
# see git-prunerefs
[include]
path= "diffr"
2021-02-16 12:11:05 +00:00
[includeIf "gitdir:yadm/repo.git"]
path = "~/.config/yadm/gitconfig"
2022-11-19 18:57:52 +00:00
[safe]
directory = /opt/flutter
2023-09-18 15:41:53 +00:00
[credential]
helper = cache --timeout 1000