config/git: little alias improvements

This commit is contained in:
xeruf 2021-05-06 08:29:05 +02:00
parent dcad94ba64
commit 1fe58f4f40
4 changed files with 10 additions and 7 deletions

View File

@ -115,7 +115,7 @@
cme = commit -v --edit --message
cp = cherry-pick
rb = rebase --autostash
rb = rebase
rbi = rebase --interactive
rbc = rebase --continue
rbm = !git rb $(git main)

View File

@ -87,7 +87,7 @@ gitremote() {
git:*) echo "$1" ;;
*) test "$3" = "cau" && 3="CAU-Kiel-Tech-Inf"
test "$3" = "btl" && 3="betweenthelinesev"
echo "git@${1:-github.com}:${3:-xerus2000}/${2:-$(basename $PWD)}.git" ;;
echo "git@${1:-github.com}:${3:-$(git config user.name)}/${2:-$(basename $PWD)}.git" ;;
esac
}

View File

@ -1,5 +1,5 @@
#!/bin/sh
if git rev-parse @{u} 2>/dev/null >/dev/null
if git rev-parse @{upstream} >/dev/null 2>&1
then git push "$@"
else git push --set-upstream "$@"
fi

View File

@ -1,5 +1,8 @@
#!/bin/sh
# Interactive rebase onto the remote
remote="$1"
test $# -gt 0 && shift
git rebase -i ${remote:-'@{push}'} "$@"
# Interactive rebase onto the given committish, the matching upstream branch
# or the first named ref from the history if there is no upstream yet.
if test $# -gt 0
then remote="$1"; shift
else remote=$(git rev-parse --verify --quiet @{push} || git rev-parse $(git describe --all HEAD~ | cut -d '-' -f-2))
fi
git rebase -i "$remote" "$@"