git check first commit

C++
git rev-list --max-parents=0 HEAD

Source

Also in C++: