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

Re: Minor UX annoyance w/`git add --patch untracked/file`

From
Taylor Blau <me@ttaylorr.com>
Date
Dec 8, 2023, 22:29 UTC
Message-ID
<ZXOY1Qq4MKQPEEAZ@nand.local>
In-Reply-To
<xmqqmsuk1jvp.fsf@gitster.g>
On Sat, Dec 09, 2023 at 06:09:46AM +0900, Junio C Hamano wrote:
Show 14 quoted lines
> Jeff King <peff@peff.net> writes:
>
> > They _could_, but keep in mind that the argument is not strictly a path.
> > It is a pathspec that may match multiple paths. So:
> >
> >   git add -p path/to/
> >
> > for example will pick up the tracked files in path/to/, but not your
> > untracked one.
>
> The corresponding command w/o "-p", i.e., "git add path/to/", will
> pick up both tracked and untracked ones from the named directory,
> while honoring the ignore settings.  So I suspect it might feel more
> natural if "-p" followed suit.

I tend to agree. I do think that the full specification of when "git add -p" implies "git add -N ... && git add -p" would be difficult to explain to users.

But I think it's a worthwhile trade-off in that it makes the UX more consistent in the common case (where the argument to add is a literal path, not a pathspec).

Thanks, Taylor

Previous: Junio C Hamano
Message 4 of 4 in “Minor UX annoyance w/`git add --patch untracked/file`”
  1. Vito CaputoNov 30, 2023
  2. Jeff KingDec 6, 2023
  3. Junio C HamanoDec 8, 2023
  4. Taylor BlauDec 8, 2023

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.