Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork942
Closed as not planned
Description
Setup
Running onGitPython==3.1.27
MacOS monterey
,Python 3.10.5
Reproduce the bug
git checkout <commit>
-> leads to a detached HEAD
from pathlib import Pathfrom git import Repodef repo() -> 'Repo': from git import Repo # type: ignore return Repo(Path(__file__).parent, search_parent_directories=True)repository = repo()repository.active_branch.name
Error log
❯ python3 test.pyTraceback (most recent call last): File "/test.py", line 9, in <module> repository.active_branch.name File "/venv/lib/python3.10/site-packages/git/repo/base.py", line 797, in active_branch return self.head.reference File "/venv/lib/python3.10/site-packages/git/refs/symbolic.py", line 294, in _get_reference raise TypeError("%s is a detached symbolic reference as it points to %r" % (self, sha))TypeError: HEAD is a detached symbolic reference as it points to '7sfaslkhfuhajkfnjaksdhfc4ede32c'
visual proof
Metadata
Metadata
Assignees
Labels
No labels