More robustly generate the git commit ID and branch