Various fixes for git driver

This fixes the issue where the cloned repository's remote is the local docs repo, and so never gets updated. It also fixes handling of branches, and caches the result of branch lookup to stay performant

See #2 for context