def save(self, doc):
        if doc.id:
            return self.update(doc)
        else:
            return self.insert(doc)
def mkhead(repo: 'Repo', path: PathLike) -> 'Head':
    """:return: New branch/head instance"""
    return git.Head(repo, git.Head.to_full_path(path))