From 34ab2d5522c0fe0e6d75cf86a34c99d17e69403d Mon Sep 17 00:00:00 2001 From: Hendrik Boll Date: Thu, 3 Jul 2025 21:00:38 +0200 Subject: [PATCH] git: update aliases, inspired by magit --- dot_config/git/config | 42 +++++++++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/dot_config/git/config b/dot_config/git/config index 67b4c7f..3e195aa 100644 --- a/dot_config/git/config +++ b/dot_config/git/config @@ -16,20 +16,48 @@ allowedSignersFile = ~/.config/git/allowed_signers [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 ss = s -uno - bs = switch - bc = switch -c + si = "!hx $(git root)/.gitignore" + + 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 c = commit cm = commit -m + co = checkout 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] sort = -committerdate