Skip to content

fix(branch): block checkout of remote HEAD symbolic refs (#2681)#2944

Open
leno23 wants to merge 1 commit into
gitui-org:masterfrom
leno23:fix/remote-head-checkout-2681
Open

fix(branch): block checkout of remote HEAD symbolic refs (#2681)#2944
leno23 wants to merge 1 commit into
gitui-org:masterfrom
leno23:fix/remote-head-checkout-2681

Conversation

@leno23
Copy link
Copy Markdown

@leno23 leno23 commented May 17, 2026

Summary

Selecting a remote */HEAD entry in the branch dialog could create a local HEAD branch and trigger refname 'HEAD' is ambiguous.

  • Filter all remote HEAD symbolic refs from the branch list (retain, not a single remove)
  • Reject checkout_remote_branch for those refs
  • Derive the local branch name from the segment after the remote name (fixes /HEAD from origin/HEAD)

Closes #2681.

Test plan

  • cargo test -p asyncgit checkout_remote
  • Branch dialog → Remotes: no origin/HEAD (or upstream/HEAD) entry
  • Cannot create a local HEAD branch via the UI

Made with Cursor

)

Hide remote `*/HEAD` entries from the branch list and reject checkout
attempts so gitui no longer creates a local `HEAD` branch.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fetching HEAD creates a local HEAD branch

1 participant