git: update aliases, inspired by magit

This commit is contained in:
fanyx 2025-07-03 21:00:38 +02:00
parent b35ca70be4
commit 34ab2d5522
Signed by: fanyx
SSH key fingerprint: SHA256:Gwc2cuQkLEIzOapSR+R8raHvC1bSAkPsYuPqlPoFlD8

View file

@ -16,20 +16,48 @@
allowedSignersFile = ~/.config/git/allowed_signers allowedSignersFile = ~/.config/git/allowed_signers
[alias] [alias]
root = rev-parse --show-toplevel
current-branch = symbolic-ref --short HEAD
b = branch
bb = switch
bc = switch -c
bcf = bc -f
bx = branch -d
bxf = bx -f
br = branch -m
brx = br -f
mm = merge
r = rebase
ri = rebase -i
rp = rebase @{upstream}
s = status -sb s = status -sb
ss = s -uno ss = s -uno
bs = switch si = "!hx $(git root)/.gitignore"
bc = switch -c
pp = pull
pe = """!git_remote=$(git remote | fzf); \
git_branch=$(git current-branch); \
[ -z $git_remote ] && echo 'No remote selected.' && exit 1; \
git pull $git_remote $git_branch"""
a = add a = add
c = commit c = commit
cm = commit -m cm = commit -m
co = checkout
d = diff d = diff
l = log
sl = log --pretty='format:%h %G? %s%d' -n20 --graph --color
fixup = "!git log -n50 --pretty='format:%h %s' --no-merges | fzf | cut -c -7 | xargs -o git commit --fixup"
ri = rebase -i
pru = "!git pull -r --autostash upstream $(git remote show upstream | sed -n '/HEAD branch/s/.*: //p')"
l = log -n20 --graph --color --decorate --oneline
ll = log --all --graph --color --decorate
fixup = """!git_commit=$(git log -n50 --pretty='format:%h %s' --no-merges | fzf | cut -c -7); \
git commit --fixup $git_commit"""
pru = !git pull -r --autostash $(git rev-parse --abbrev-ref @{upstream} | tr '/' ' ')
ui = !lazygit
[branch] [branch]
sort = -committerdate sort = -committerdate