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

Suggestion: better error message when an ambiguous checkout is executed

From
Mahmoud Al-Qudsi <mqudsi@neosmart.net>
Date
Aug 7, 2017, 21:49 UTC
Message-ID
<CACcTrKdzVCKUR8EfwhqBQR7vWzRqTLcwRJ_r-hx3VztD=xvNuQ@mail.gmail.com>
Hello,

The default git behavior when attempting to `git checkout xxx` for some value of "xxx" that cannot be resolved to a single, unique file/path/branch/tag/commit/etc is to display the following:

> error: pathspec 'xxx' did not match any file(s) known to git

Unfortunately, this is (IMHO) at best misleading when the actual case is that "git could not unambiguously resolve pathspec xxx"

Can the case where xxx _was_ resolved but to more than one value be improved in both utility and comprehensibility by providing an error message that

1) indicates that xxx was a valid pathspec, but not a unique one
2) provides a list of unique pathspecs that xxx matched against

e.g. in the case where xxx is the name of a branch on both origin1 and origin2, it would be ideal if git could instead report

> error: pathspec 'xxx' could not be uniquely resolved
> xxx can refer to one of the following:
> * branch origin1/xxx
> * branch origin2/xxx
or, less ideally but much simpler, only the first line of that message?
Thank you,

Mahmoud Al-Qudsi NeoSmart Technologies

Next: Junio C Hamano
Message 1 of 3 in “Suggestion: better error message when an ambiguous checkout is executed”
  1. Mahmoud Al-QudsiAug 7, 2017
  2. Junio C HamanoAug 7, 2017
  3. Junio C HamanoSep 12, 2017

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.