Improve implementation of GitRepository::checkout