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, 23:34 UTC
Message-ID
<xmqq8qmgpaxh.fsf@gitster.g>
In-Reply-To
<09518eac-948e-46be-9cd2-64304e78af81@app.fastmail.com>
"Kristoffer Haugsbakk" <kristofferhaugsbakk@fastmail.com> writes:
> I have also not seen anyone really recommend using this option.
You mean "git commit -a"?

I actually do to anybody who is the kind of person who concentrates on a single thing and completes that single thing well before moving to another task. It is a perfect tool for the job for such a way of working.

Like when doing "git merge" or "git pull". There, the "single thing" that the person concentrates on is to complete the merge, and with a reasonably written pre-commit hook to make sure there is no leftover conflict markers [*], "git commit -a" to conclude a conflicted merge is fairly safe.

[Footnote]
 * There should actually be pre-add hook to make it even less
   annoying.  After you see conflicts, "git add -u" happily adds the
   contents of the files in the working tree, with conflict markers
   still in them.  You can rely on the pre-commit hook that is
   triggered when you run "git commit" next time, and then use "git
   checkout -m" to recreate the conflicted higher-stage index
   entries for these paths, but if we had pre-add hook, we shouldn't
   have to know how to recover from such a mistake in the first
   place.
Previous: Junio C Hamano
Message 7 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.