I know this is late but on a linux/mac ,from the terminal you can use the following.
git status | sed -n 1p
Explanation:
git status -> gets the working tree status
sed -n 1p -> gets the first line from the status body
Response to the above command will look as follows:
"On branch your_branch_name"