3 git symbolic-ref -q HEAD >/dev/null && exit
8 branches=(`git branch --points-at=HEAD | tail -n +2`)
9 if [ "${#branches[*]}" -eq 0 ]; then
10 branches=(`git branch --points-at=HEAD -r | sed 's!^ *origin/!!'`)
13 if [ "${#branches[*]}" -eq 0 ]; then
14 echo "Cannot find a branch" >&2
15 elif [ "${#branches[*]}" -eq 1 ]; then
16 git checkout "${branches[0]}"
18 echo "Too many branches" >&2