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

Re: git checkout error

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 9, 2012, 23:47 UTC
Message-ID
<7v626jdx8f.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CAB9Jk9CZ8d=8ugYs7XHXs84Kj9xJmTHZyZ2J0hU66OBS7YDZTg@mail.gmail.com>
Angelo Borsotti <angelo.borsotti@gmail.com> writes:
> The man page describes --track and --no-track as "options". 

But the problem you observed is *not* about --track or --no-track. It is about the "-b <branchname>" option.

You used the -b option that requires an argument, and as that argument, you gave a string "--no-track", as if you wanted to create a branch whose name is "--no-track". After these words on the command line are understood, there are two other arguments left on the command line, which is an syntax error as far as "git checkout" is concerned.

Again, this is asked-and-answered recently, and 
    http://thread.gmane.org/gmane.comp.version-control.git/204397

has resulted in a leading to b6312c2 (checkout: reorder option handling, 2012-08-30), which is in v1.8.0-rc0 and onwards. You should get an error message that is a lot less confusing:

    $ git checkout -b --no-track topic remotes/origin/master
    fatal: '--no-track' is not a valid branch name.
Previous: Angelo BorsottiNext: Angelo Borsotti
Message 5 of 8 in “git checkout error”
  1. Angelo BorsottiOct 9, 2012
  2. Andreas SchwabOct 9, 2012
  3. Junio C HamanoOct 9, 2012
  4. Angelo BorsottiOct 9, 2012
  5. Junio C HamanoOct 9, 2012
  6. Angelo BorsottiOct 10, 2012
  7. Junio C HamanoOct 10, 2012
  8. Angelo BorsottiOct 10, 2012

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.