git: Prepare for config refactoring

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

Change-Id: d8ebe787c5
wip [ci skip]

Change-Id: 4058febb17