git version generation fixes

- Remove the `version` file created for the tarball after the tarball is finished
- Use the builtin type instead of which.