fixed some problems with HEAD branch

"line 89: [: too many arguments"
fixed problem with multiple matching branches

"line 65: [: … unary operator expected"
fixed another issue with multiple branches matching

e.g. if origin/develop is the main branch then
origin/developer would not be mentioned when it's
created