This combination of git commands doesn't sit well with me. How about something like this:

```
git fetch origin "+${git_ref}"
git checkout -q -B "$git_ref" "origin/${git_ref}"
```