Skip to content

Repo.heads only shows the master branch #1079

@mengjade

Description

@mengjade

I used GitHub Desktop to clone a repo with two branches from URL.
The following scripts only print the master branch.

repoRepo = git.Repo(os.getcwd())
print(repoRepo.heads)

If I switch to the other branch using GitHub Desktop, then it returns two heads. If I switch back to master again, it also shows two heads.
image

Is there a way to show all the heads at the beginning to avoid this manual work? For example, if I have 10 branches, i don't want to manually switch the branches 10 times to get them into Repo.heads.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions