adding better error catching for git branch detection