git: Prepare for config refactoring

Pulled some functions into a separate package, git/gitutil, because we will need
to break an import dependency circle for the config refactoring in the following
commit.

Change-Id: bd95190636