config/git: update essential aliases

This commit is contained in:
xerus2000 2020-11-12 09:56:29 +01:00
parent 2dae9c098f
commit a5f933217e
2 changed files with 14 additions and 11 deletions

View File

@ -56,6 +56,7 @@
sta = stash sta = stash
stl = stash list stl = stash list
sts = stash show -v
stp = stash pop stp = stash pop
std = stash drop std = stash drop
@ -69,17 +70,19 @@
f = fetch f = fetch
fa = fetch --all fa = fetch --all
l = !git pull --rebase --autostash || (>&2 echo "Error - aborting rebase!" && git rebase --abort)
l = pull lg = log --pretty=tformat:'%C(auto)%h -%d %s %Cgreen(%cd) %Cblue<%an>%Creset' --date=human --graph
lg = log --pretty=tformat:'%C(auto)%h -%d %s %Cgreen(%cd) %Cblue<%an>%Creset' --date=human --no-merges lo = log --pretty=tformat:'%C(auto)%h -%d %s %Cgreen(%cd) %Cblue<%an>%Creset' --date=human --no-merges
ln = !git --no-pager lg -5 ln = !git --no-pager lo -5
my = lg --author erus my = lo --author erus
standup = lg --since yesterday --author erus --all standup = lo --since yesterday --author erus --all
co-authors = !git log | grep -i Co-Authored | awk '!a[$0]++' 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 when = git for-each-ref --sort=committerdate --format='%(refname:short) * %(authorname) * %(committerdate:relative)' refs/remotes/ # List all branches with their last updates
dir = !git root | sed 's/$/\\/.git/' | grep --color=never "/" # grep ensures a proper exit status on fail dir = !git root | sed 's/$/\\/.git/' | grep --color=never "/" # grep ensures a proper exit status on fail
upstream = !git rev-parse --abbrev-ref --symbolic-full-name @{u} || echo origin/$(git curbranch) upstream = !git rev-parse --abbrev-ref --symbolic-full-name @{upstream} || git rev-parse --abbrev-ref --symbolic-full-name @{push} || echo origin/$(git curbranch)
sup = !git branch --set-upstream-to @{push}
a = add -u a = add -u
aa = add -u . aa = add -u .
@ -98,14 +101,14 @@
rh = reset HEAD~ rh = reset HEAD~
rs = reset --keep rs = reset --keep
ru = reset --keep @{u} ru = reset --keep @{upstream}
unstage = reset HEAD -- unstage = reset HEAD --
gcr = !git gc && git repack -a -d gcr = !git gc && git repack -a -d
ready = rebase -i @{u} ready = rebase -i @{upstream}
format-head = !git stash && git-clang-format HEAD~ && git commit -a --amend --no-edit && git stash pop format-head = !git stash && git-clang-format HEAD~ && git commit -a --amend --no-edit && git stash pop
sm = !git submodule init && git submodule update sm = submodule update --init --recursive
# yadm # yadm
add-git = !yadm add $XDG_CONFIG_HOME/git/config $CONFIG_SHELLS/git add-git = !yadm add $XDG_CONFIG_HOME/git/config $CONFIG_SHELLS/git

View File

@ -64,7 +64,7 @@ gitrebranch() {
gitrmbranch() { gitrmbranch() {
branch=${1:-$(git curbranch)} branch=${1:-$(git curbranch)}
git push -d $(git rev-parse --abbrev-ref $branch@{u} | sed 's/\// /' || echo origin $branch) git push -d $(git rev-parse --abbrev-ref $branch@{u} | sed 's/\// /' || echo origin $branch)
test $1 || git checkout master || git checkout $(cat .git/refs/remotes/origin/HEAD | cut -d'/' -f4) test $1 || git checkout main || git checkout master || git checkout $(cat .git/refs/remotes/origin/HEAD | cut -d'/' -f4)
git branch -D $branch git branch -D $branch
} }
@ -87,7 +87,7 @@ gitretag() {
# Repo management {{{ # Repo management {{{
gitinit() { gitinit() {
git init git init -b main
git add . git add .
git commit -m "First strike" git commit -m "First strike"
gitorigin "$@" gitorigin "$@"