git log with numbers

C++
git log --oneline | nl
Source

Also in C++: