-
-
Save evnm/7634093 to your computer and use it in GitHub Desktop.
A fuzzy `git checkout`.
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/sh | |
# A fuzzy `git checkout`. | |
match=`git rev-parse --abbrev-ref --branches="*$1*"` | |
case `wc -w <<< "$match" | tr -d ' '` in | |
"0") echo "error: '$1' did not match any branch." 2>&1 ;; | |
"1") git checkout $match ;; | |
*) echo "error: '$1' is ambigious among:\n$match" 2>&1 | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment