Refactor git

This basically just moves the `Git` class to a higher level in the hierarchy, splits it up to smaller classes, and adds a bit of test coverage.