Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/local/bin/bash
- str="/$*/"
- str=$(echo "$str" | sed 's/ /\/ \&\& \//g')
- str="print if $str"
- res=$(git branch --all | perl -ne "$str")
- res=$(echo $res | tr ' ' '\n' | cut -d/ -f3-)
- matches=$(echo $res | tr ' ' '\n' | uniq -u | wc -l)
- if (( $matches == 1 )); then
- git checkout "$res"
- else
- echo $res | tr ' ' '\n'
- fi
Add Comment
Please, Sign In to add comment