Move the git implementations to classes

This will help the implementation of (optionally) using pygit2.