I don't buy it.

You should Google it, and you will find lot of better solutions. `git branch` does other things rather than just checking it is a git repos or not.