zsh: Make "gb" more ergonomic

This commit is contained in:
2020-12-08 22:04:06 +01:00
parent 56067d0387
commit 49c38a40f5

View File

@@ -289,10 +289,15 @@ clip() {
gb() { gb() {
_superproject="$(git rev-parse --show-superproject-working-tree)" _superproject="$(git rev-parse --show-superproject-working-tree)"
_root="$(git rev-parse --show-toplevel)"
if [[ -n "${_superproject}" ]] ; then if [[ -n "${_superproject}" ]] ; then
builtin cd "${_superproject}" if [[ "$(pwd)" == "${_root}" ]] ; then
builtin cd "${_superproject}"
else
builtin cd "${_root}"
fi
else else
builtin cd "$(git rev-parse --show-toplevel)" builtin cd "${_root}"
fi fi
} }