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.
fixed in https://github.com/travis-ci/travis-build/commit/cce0cd6fdfdecb188aa845afbc5f44b95b34d373