Let\'s imagine the blerp command line tool maintained on git. This tool has the (hidden) --version option which returns its version (let\'s say 0.1.2
Please, have a look at git describe command. This command shows you the latest tag and an amount of commits made after the tag was set. It also possible to show the dirtiness of the repository.
As you mentioned this command wouldn't work without the git repository (.git folder) and git installed. But it's almost unimaginable developer today without git but with all other tools installed.