how to check current branch in git

C++
git branch -a # it will show an astrick * like *master
git branch --show-current # source == git remote --helpgit rev-parse --abbrev-ref HEAD
git rev-parse --abbrev-ref HEAD
// To check the current branch
Source

Also in C++: