]> git.wh0rd.org - home.git/blobdiff - .bin/git-rb-all
git-rb-all: handle missing working dirs
[home.git] / .bin / git-rb-all
index e20c83aca54e70591abb39d73ecae48bfff9ac2b..ef3f54c773596eb17cf39607052b1392f2f947e5 100755 (executable)
@@ -9,7 +9,7 @@ rb_one() {
                echo " -> skipping due to missing merge branch"
        else
                echo
-               git checkout -q "${b}" || exit
+               git checkout -q "${b}" || return
                if ! git rebase ; then
                        git rebase --abort
                fi
@@ -28,6 +28,9 @@ main() {
                usage
        fi
 
+       # Switch to the top dir in case the working dir doesn't exist in every branch.
+       cd "$(git rev-parse --show-toplevel)" || return
+
        local orig b branches
        orig=$(git rev-parse --abbrev-ref HEAD) || return