Use `git ref-parse` for geting the commit-hashes instead of do-it-outself.

This leaves the dirty work for handling corner-cases to git.