Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- ticket=$1
- if [[ "$ticket" == "" ]]; then
- echo "Usage: $0 <PARTIAL BRANCH NAME>"
- exit 1
- fi
- declare -a branches
- branches=($(git branch | grep $ticket | tr -d '*'))
- if [[ ${#branches[@]} -eq 1 ]]; then
- git checkout ${branches[0]}
- else
- echo "hmmm... there are a couple of matching branches:"
- IFS="
- "; echo "${branches[*]}"
- exit 1
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement