git get current commit hash

C++
git rev-parse HEAD
Source

Also in C++: