how to get current git branch

C++
git branch --show-current
git rev-parse --abbrev-ref HEAD
git rev-parse --abbrev-ref HEAD
// To check the current branch
Source

Also in C++: