git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Why won't git checkout a branch?

From
Chris Torek <chris.torek@gmail.com>
Date
Jul 1, 2020, 15:13 UTC
Message-ID
<CAPx1Gvc+pWe6UwRREHMkUCViYjzQgfg1jfbWy2pyFQCjhwV+Bg@mail.gmail.com>
In-Reply-To
<CAH8yC8kxY5mV0p-98W0uDN7PLxmNR4LkNcz9vbKsq21aTd-qQg@mail.gmail.com>
On Wed, Jul 1, 2020 at 3:10 AM Jeffrey Walton <noloader@gmail.com> wrote:
> This does not look normal, either. I don't want to create a new
> branch. I want to work on the existing branch.

Technically, you *have to* create a new branch here: you do not have an `m4` branch (yet). Your local repository's branches are independent of the branches in the repository you cloned.

(You could work in detached HEAD state to avoid the technical requirement here but that's not practical for normal humans. :-) )

The suffix-`--` trick works in old versions of Git, creating the `m4` branch from the `origin/m4` name. If you upgrade to Git 2.23 or later and use `git switch`, I think you will find that it's generally more user friendly.

Chris
Previous: Jeffrey Walton
Message 6 of 6 in “Why won't git checkout a branch?”
  1. Jeffrey WaltonJul 1, 2020
  2. Andreas SchwabJul 1, 2020
  3. Jeffrey WaltonJul 1, 2020
  4. Andreas SchwabJul 1, 2020
  5. Jeffrey WaltonJul 1, 2020
  6. Chris TorekJul 1, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.