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

Re: [PATCH] worktree: add shorthand '-d' for detach

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 27, 2020, 20:31 UTC
Message-ID
<xmqq36c0bpzp.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<CAPig+cS_H+FTcZkBz4dA94bAcxv0CZ8UG=P8jOGvD=HXzf8ODQ@mail.gmail.com>
Eric Sunshine <sunshine@sunshineco.com> writes:
Show 9 quoted lines
>> Here I would prefer to keep '--detach', because "detach" is a real
>> word with proper meaning, while 'd' is just an abbreviation.
>
> I fully agree with this assessment and was going to say the same.
> '-b' and '-B' are special in that they don't have corresponding long
> option names, thus they must be shown in short form, but long name
> '--detach' is much more informative in this context (and the reader
> can discover short '-d' easily enough without mentioning it here).
> So, I'd drop this change (and the other similar one).
Yup.  

Even though I do not mind a short-hand '-d', because "worktree add" would be quite a rare event compared to the use of other Git subcommands, those who do not remember '--detach' after learning it would not have any better chance to remember to use the option, even if a shorter variant '-d' was available.

In other words, if "worktree add --detach" is underused and it is a problem that needs to be fixed, I do not think the reason why it is underused is *not* because "--detach" is too long to type or does not get completed when "git worktree add <TAB>" is typed. Isn't the real problem because people do not even *know* that the choice of starting a worktree without being on a particular branch exists?

A better documentation would help, but I do not think
    "git worktree add -d foo" is about as easy to type and remember as
    "git worktree add foo"

is addressing the right problem. s/-d/--detach/ may make it more clear what the option is about, in which case it would be a better way to promote the feature.

Previous: Eric SunshineNext: Eric Sunshine
Message 4 of 5 in “worktree: add shorthand '-d' for detach”
  1. worktree: add shorthand '-d' for detachPratyush Yadav, Jan 25, 2020
  2. SZEDER GáborJan 27, 2020
  3. Eric SunshineJan 27, 2020
  4. Junio C HamanoJan 27, 2020
  5. Eric SunshineJan 27, 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.