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

Re: "git commit -a" Doesn't Add New Files. Why?

From
Junio C Hamano <gitster@pobox.com>
Date
May 28, 2025, 22:24 UTC
Message-ID
<xmqqjz60pe65.fsf@gitster.g>
In-Reply-To
<aDXo0Enj4cQzKQkK@ubby>
Nico Williams <nico@cryptonector.com> writes:
Show 8 quoted lines
> On Tue, May 27, 2025 at 09:03:55AM -0700, Jon Forrest wrote:
>> The documentation clearly says that running "git commit -a"
>> doesn't add new files to the index. I wonder why that choice
>> was made.
>
> I use `git commit -a` all the time in workspaces that are dirty.  It
> would be exceedingly annoying if `git commit -a` were to act like `git
> add . && git commit`.

True, but not quite. You would want your "git add ." to be safe in dirty working trees---at least some folks wanted so badly enough that "git add ." pays attention to the ".gitignore" mechanism.

But `git commit -a` would not change, even if it won't add cruft with well curated .gitignore files. That will be a terrible backward incompatible change for those who expect it only deals with the files it knows about (including the one that is not yet tracked but its presence is known via "git add -N").

Previous: Nico WilliamsNext: Jon Forrest
Message 3 of 7 in “"git commit -a" Doesn't Add New Files. Why?”
  1. Jon ForrestMay 27, 2025
  2. Nico WilliamsMay 27, 2025
  3. Junio C HamanoMay 28, 2025
  4. Jon ForrestMay 28, 2025
  5. Kristoffer HaugsbakkMay 27, 2025
  6. Junio C HamanoMay 28, 2025
  7. Junio C HamanoMay 28, 2025

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.