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.
getversion: apply the changes described in doc
getversion: also fix the stable-* rules