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

Re: Why won't git checkout a branch?

From
JWJeffrey Walton <noloader@gmail.com>
Date
Jul 1, 2020, 10:45 UTC
Message-ID
<CAH8yC8=SgS1=mpSM_7j8FQzreVPfE5U_tnsCz9ixZoBHLUuM7A@mail.gmail.com>
In-Reply-To
<87lfk3czae.fsf@igel.home>
On Wed, Jul 1, 2020 at 6:20 AM Andreas Schwab <schwab@linux-m68k.org> wrote:
Show 22 quoted lines
>
> On Jul 01 2020, Jeffrey Walton wrote:
>
> > On Wed, Jul 1, 2020 at 5:50 AM Andreas Schwab <schwab@linux-m68k.org> wrote:
> >>
> >> On Jul 01 2020, Jeffrey Walton wrote:
> >>
> >> > $ git checkout m4
> >>
> >> Try a newer git version:
> >>
> >> $ git checkout m4
> >> fatal: 'm4' could be both a local file and a tracking branch.
> >> Please use -- (and optionally --no-guess) to disambiguate
> >
> > Ack, thanks.
> >
> > This does not look normal, either. I don't want to create a new
> > branch. I want to work on the existing branch.
>
> To disambiguate, use `git checkout m4 --' if you want the branch, and
> `git checkout -- m4' if you want the local file.
Perfect, thanks.
So the way to checkout that always works is to append --. Is that correct?
If so, I will start using it everywhere.
Jeff
Previous: Andreas SchwabNext: Chris Torek
Message 5 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.