import git

class Git:
    def __init__(self, repo_path):
        try:
            self.repo = git.Repo(repo_path)
        except git.InvalidGitRepositoryError:
            raise ValueError(f"Invalid git repository at {repo_path}")

    def get_branches(self):
        return self.repo.branches

    def get_commits(self):
        return list(self.repo.iter_commits())

    def get_head(self):
        return self.repo.head.commit

    def get_repo(self):
        return self.repo

    def get_tags(self):
        return self.repo.tags
