guard git accesses against runs from non-git-repos
move `get_fields` helper to `util.py`
move git helpers to `git.py`