Fix step 1: for dev-local uses, properly detect local Git branch and commit
Fix step 2: properly detect local Git branch, and just keep pre-provided one if any.
Fix step 3: code cleanup + faster/nimbler use of Git to obtain data (rev-parse and cat-file instead of multiple log calls)