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

Re: 'git commit .' in a subdirectory also commits staged files in other subdirectories

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 21, 2022, 22:02 UTC
Message-ID
<xmqqy1t8j0nw.fsf@gitster.g>
In-Reply-To
<Y1MTtNcUHyv76UEV@nand.local>
Taylor Blau <me@ttaylorr.com> writes:
Show 10 quoted lines
>> 'git commit .' in one of them attempted to commit all of them, not
>> only the files in that subdirectory.
>>
>> This is a very unreasonable behavior, because while being in any
>> subdirectory 'git commit .' should only affect that subdirectory, and
>> not files elsewhere.
>
> That isn't right, though I can't reproduce what you describe from your
> report. Try this script out:
> ...

"git commit --include ." would exhibit the behaviour, but that should not be the default, so I am also puzzled.

Previous: Taylor BlauNext: Yuri
Message 3 of 4 in “'git commit .' in a subdirectory also commits staged files in other subdirectories”
  1. YuriOct 21, 2022
  2. Taylor BlauOct 21, 2022
  3. Junio C HamanoOct 21, 2022
  4. YuriNov 7, 2022

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.