Some changes to GIT/Version handling (REBASED)

Rebased version of #278.