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

Re: Automagic `git checkout branchname` mysteriously fails

From
Duy Nguyen <pclouds@gmail.com>
Date
Oct 17, 2016, 11:39 UTC
Message-ID
<CACsJy8A252mU8hgp2d+LQ8vku1w-sL9eP=t=G1AX61WJi8SUfA@mail.gmail.com>
In-Reply-To
<CACPiFCJFXGmsJX97kQuA2h3trVX7L3SacwKrD4mpEU5SPxkLAA@mail.gmail.com>

On Sat, Oct 15, 2016 at 4:06 AM, Martin Langhoff <martin.langhoff@gmail.com> wrote:

Show 16 quoted lines
> On Fri, Oct 14, 2016 at 4:58 PM, Kevin Daudt <me@ikke.info> wrote:
>> Correct, this only works when it's unambiguous what branch you actually
>> mean.
>
> That's not surprising, but there isn't a warning. IMHO, finding
> several branch matches is a strong indication that it'll be worth
> reporting to the user that the DWIM machinery got hits, but couldn't
> work it out.
>
> I get that process is not geared towards making a friendly msg easy,
> but we could print to stderr something like:
>
>  "branch" matches more than one candidate ref, cannot choose automatically.
>  If you mean to check out a branch, try git branch command.
>  If you mean to check out a file, use -- before the pathname to
>  disambiguate.

Or even better, list all ambiguous candidates like Jeff did for ambiguous short SHA-1 in 1ffa26c (get_short_sha1: list ambiguous objects on error - 2016-09-26).There were a few occasions I was confused by ambiguous refs and displaying them all would help me see what problem was much faster.

-- 
Duy
Previous: Martin Langhoff
Message 4 of 4 in “Automagic `git checkout branchname` mysteriously fails”
  1. Martin LanghoffOct 14, 2016
  2. Kevin DaudtOct 14, 2016
  3. Martin LanghoffOct 14, 2016
  4. Duy NguyenOct 17, 2016

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.