diff --git a/.config/git/config b/.config/git/config index 828a8d7..a819efd 100644 --- a/.config/git/config +++ b/.config/git/config @@ -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) diff --git a/.config/shell/git b/.config/shell/git index 3034fff..ddad2d7 100644 --- a/.config/shell/git +++ b/.config/shell/git @@ -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 } diff --git a/.local/bin/scripts/git-p b/.local/bin/scripts/git-p index e391338..d174b47 100755 --- a/.local/bin/scripts/git-p +++ b/.local/bin/scripts/git-p @@ -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 diff --git a/.local/bin/scripts/git-ready b/.local/bin/scripts/git-ready index a15b702..eebdd09 100755 --- a/.local/bin/scripts/git-ready +++ b/.local/bin/scripts/git-ready @@ -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" "$@"