Git: use HEAD to determine current hash

This is more robust in a detached HEAD situation.