I\'m not sure why I\'m unable to checkout a branch that I had worked on earlier. See the commands below (note: co is an alias for checkou
I had a different root cause
I had a script that basically searches all branches matching jira issue key in the for "PRJ-1234" among all branches to execute a git branch checkout command on the matching branch
The problem in my case was 2 or more branches shared the same jira key and hence caused my script to fail with the aforementioned error
By deleting the old unused branch and making sure only a single branch had the jira key reference fixed the problem
Here's my code in case someone wants to use it
git remote update
git fetch --all --prune
git branch -r --list *$1* | xargs git checkout --force
save this as switchbranch.sh
Then use it from the terminal ./switchbranch.sh PRJ-1234