Last active
June 23, 2022 15:17
-
-
Save chandeeland/bea44e482887bb496f1c26b0cd412b77 to your computer and use it in GitHub Desktop.
a little bash toy to help find branches easier
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
GIT=`which git` | |
FOUND=`$GIT branch | grep $1 | sed -e 's/^[ *] //' | sed -e 's/remotes\/origin\///g' |sort -u` | |
NUM_FOUND=`echo $FOUND|wc -l` | |
echo | |
if [ $NUM_FOUND -gt 1 ]; then | |
echo 'FOUND THESE MATCHING BRANCHES' | |
echo | |
echo "$FOUND" | |
elif [ $NUM_FOUND -eq 1 ]; then | |
echo 'you got it' | |
git checkout $FOUND | |
else | |
echo 'NOT FOUND' | |
fi | |
echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment