Git branch name improvements

After initialized an empty git repo, there weren't any branches and I had an error 'test: Missing argument at index 2
' so I added comparison checks if there is at least one branch. I also changed the way to display branch name and put it between two square brackets which is IMO more readable.