The problem
Description
GitHub Desktop Plus enters a detached HEAD state when switching back to a branch whose name is also used by a tag.
The repository contains:
Initially, everything works as expected. However, after switching from main to another branch and then back to main using GitHub Desktop Plus, the application reports a detached HEAD state.
Release version
Version 3.5.12.0 (x64)
Operating system and distro
Fedora Workstation
Steps to reproduce the behavior
- Create a branch named
main.
- Create a tag also named
main.
- Open the repository in GitHub Desktop Plus.
- Start on the
main branch.
- Switch to another branch.
- Switch back to
main.
Specific to GitHub Desktop Plus?
Occurs in both
Log files
No response
Screenshots
Additional context
Expected Behavior
The repository should return to:
and remain attached to the branch.
Actual Behavior
GitHub Desktop Plus leaves the repository in a detached HEAD state:
HEAD detached at refs/heads/main
Additional Git output:
git symbolic-ref HEAD
fatal: ref HEAD is not a symbolic ref
git rev-parse --abbrev-ref HEAD
HEAD
The repository can be recovered manually by running:
or
although Git reports:
warning: refname 'main' is ambiguous.
Root Cause
The issue appears to be related to the coexistence of:
refs/heads/main
refs/tags/main
GitHub Desktop Plus seems to mishandle the ambiguous reference when switching branches and ends up checking out a commit instead of attaching HEAD to the branch.
Removing the tag named main resolves the issue completely.
The problem
Description
GitHub Desktop Plus enters a detached HEAD state when switching back to a branch whose name is also used by a tag.
The repository contains:
mainmainInitially, everything works as expected. However, after switching from
mainto another branch and then back tomainusing GitHub Desktop Plus, the application reports a detached HEAD state.Release version
Version 3.5.12.0 (x64)
Operating system and distro
Fedora Workstation
Steps to reproduce the behavior
main.main.mainbranch.main.Specific to GitHub Desktop Plus?
Occurs in both
Log files
No response
Screenshots
Additional context
Expected Behavior
The repository should return to:
and remain attached to the branch.
Actual Behavior
GitHub Desktop Plus leaves the repository in a detached HEAD state:
Additional Git output:
The repository can be recovered manually by running:
or
although Git reports:
warning: refname 'main' is ambiguous.Root Cause
The issue appears to be related to the coexistence of:
GitHub Desktop Plus seems to mishandle the ambiguous reference when switching branches and ends up checking out a commit instead of attaching HEAD to the branch.
Removing the tag named
mainresolves the issue completely.