diff options
| author | Robert Günzler <r@gnzler.io> | 2022-02-09 00:20:25 +0100 |
|---|---|---|
| committer | Robert Günzler <r@gnzler.io> | 2022-02-09 00:20:25 +0100 |
| commit | cb44bd26ff25fad88b811ad39f434c0144d012aa (patch) | |
| tree | 0693f02d7732dae94a12009dc86f10fbc82d9871 /.config/git | |
| parent | afd67b8d2a8e894bc338ac94303bf287bf6f590a (diff) | |
git: cleanup aliases
Diffstat (limited to '.config/git')
| -rw-r--r-- | .config/git/config | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/.config/git/config b/.config/git/config index cc46a02..11c5209 100644 --- a/.config/git/config +++ b/.config/git/config @@ -67,8 +67,11 @@ co = checkout cp = cherry-pick cr = clone --recursive + d = diff df = diff --word-diff - d = "!f() { local a=${1:-HEAD}; local b=${2:-master}; if [[ $a == '-' ]]; then a=HEAD; fi; printf ' %s is %s commits ahead and %s commits behind %s\n' `git rev-parse --short=7 $a` `git rev-list --count $b..$a` `git rev-list --count $a..$b` $b; printf ' last common commit (merge-base): %s\n' `git merge-base $a $b`; git diff --shortstat $a..$b; }; f" + ds = diff --staged + dl = diff --stat + diffsummary = "!f() { local a=${1:-HEAD}; local b=${2:-master}; if [[ $a == '-' ]]; then a=HEAD; fi; printf ' %s is %s commits ahead and %s commits behind %s\n' `git rev-parse --short=7 $a` `git rev-list --count $b..$a` `git rev-list --count $a..$b` $b; printf ' last common commit (merge-base): %s\n' `git merge-base $a $b`; git diff --shortstat $a..$b; }; f" unstage = reset --hard HEAD lp = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit ll = log --pretty=oneline --graph --abbrev-commit @@ -92,21 +95,20 @@ total-lines = "! git ls-tree -r master --name-only | xargs -I {} git blame --line-porcelain {} | sed -n 's/^author //p' | sort | uniq -c | sort -rn" fixup = "!f() { git commit --fixup=${1}; }; f" fix = fixup - fixupf = "!f() { git commit --fixup=${1} && git rebase --autosquash --interactive ${1}^; }; f" squash = "!f() { git commit --squash=${1}; }; f" r = rebase - ri = rebase --autosquash -i + ri = rebase --autostash --autosquash -i ri-pr = !bash -c 'git rebase --autosquash -i `git merge-base HEAD ${1:-origin/master}`' pushf = push --force-with-lease root = "rev-parse --show-toplevel" trailer = "!f() { trailer=${1:-}; ref=${2:-HEAD}; mode='--amend'; [ $ref != 'HEAD' ] && mode='--fixup=$ref'; msg=$(git rev-parse --show-toplevel)/LAST_COMMIT_MSG; git log -1 --format=%B $ref > $msg; git interpret-trailers --in-place --trailer $trailer $msg; git commit --allow-empty --no-verify --only --edit --file $msg $mode; rm $msg; }; f" a = add --patch - edit = !bash -c 'set -x && git ri "${1:-HEAD}"^' - oldest-ancestor = !bash -c 'diff -u <(git rev-list --first-parent ${1:-master}) <(git rev-list --first-parent ${2:-HEAD}) | sed -ne \"s/^ //p\" | head -1' rebase-onto = !bash -c 'git rebase --onto ${1} `git oldest-ancestor ${2} ${3}` ${3}' - find-by-subject = "!f() { set -ex; s=`git log -1 --format=%s ${1}`; git --no-pager log -1 --grep=\"^${s}$\" --no-merges ${2}; }; f" tig = !tig amend = commit --amend + fixnow = "!f() { git commit --fixup=${1} && git ri ${1}^; }; f" b = !fzfez git-branches l = !fzfez git-log t = !fzfez git-tags |