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

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

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 8, 2023, 21:09 UTC
Message-ID
<xmqqmsuk1jvp.fsf@gitster.g>
In-Reply-To
<20231206195407.GD103708@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 7 quoted lines
> 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.

Not that I feel strongly either way. The command has only worked with already tracked files since its inception and nobody complained in the past 15 years or so, probably because nobody cared that much for relatively rare event of creating a new file and adding it.

Thanks.
Previous: Jeff KingNext: Taylor Blau
Message 3 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.