getversion: Handle checked out tags better
getversion: update doc
getversion: use the commit SHA instead of tree SHA

Fix according to spec
getversion: prefix the commit with "-g" magic

As "git describe", we also use the "-g" magic string to denote a git hash.