NeogitOrg / NeogitOrg/neogit

Git checkout remote branch results in a detached head

Open
#127 22 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

change
Dominant language
Lua
Stars
5.6k
Forks
357
Avg merge
15h 47m
Merged PRs (30d)
2

Description

Hi,

while using the checkout branch/revision command and cycle through the branches via tab, it will autocomplete all branches. Unfortunately remote branches have the following structure remotes/origin/BRANCH_NAME.
After checking them out i will have a detached head.

Note: switching to 'remotes/origin/staging'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If a just use git checkout staging (i have just one remote) in the terminal everything is fine.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue through the checkout branch/revision command, using tab completion on a remote branch such as remotes/origin/staging. Trace the completion and checkout handling, then verify that selecting the remote branch avoids detached HEAD and behaves like git checkout staging.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, lua, neovim
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.