#!/bin/sh if ! [ -d .git ]; then echo "This directory does not have a Git repository" exit 1 fi repository=$(git branch | awk '{print $NF}' | sort -r | gum filter --limit=1) if [ -z "$repository" ]; then echo "No branch selected" exit 1 else git checkout $repository fi