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

Re: [feature request] allow directly committing untracked files

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Aug 23, 2025, 15:43 UTC
Message-ID
<aKnhvH1KHrAkfYwH@fruit.crustytoothpaste.net>
In-Reply-To
<SYBP282MB2963ABA12BD14594F62E47B08C3CA@SYBP282MB2963.AUSP282.PROD.OUTLOOK.COM>
On 2025-08-23 at 06:45:30, Isaac Oscar Gariano wrote:
> I often use 'git commit some-file -m 'some message'" to quickly make a commit, but this is annoying as it doesn't work if some-file is untracked, you first have to do 'git add some-file'.
> It would also be nice to do this with the `-a` option as well.
> Is there any reason why git does not let you do this?
I think we've seen a request for this before.

I will say that I always stage changes ahead of time because I'll often work on a few different things before committing[0] and I always want to be very sure what I'm including, but I know not everyone does that. It's also the case that sometimes files end up not being properly ignored[1], so it's very easy to accidentally include files that you wouldn't ever want to commit.

> Would people be open to me making a patch that ads this? Would it need to be behind an option for backwards-compatibility?

I can see that it would be useful. For instance, it could be convenient when writing tests of Git's behaviour where you really want to just include everything in the directory.

It would definitely need to be behind an option. I might suggest something like this:

    git commit --include-untracked -m "message" some-file

Of course, we typically reserve a final opinion on a change until we see a patch, since we're interested in both the idea behind the feature and the implementation.

[0] For instance, at work, I was fixing some software tests to run properly with reftable and I fixed several different files before committing, each of which would have needed to be its own commit. [1] I've seen this in codebases in which tests are only infrequently run by hand and where the CI doesn't care about untracked files.

-- 
brian m. carlson (they/them)
Toronto, Ontario, CA
Previous: Isaac Oscar GarianoNext: Michal Suchánek
Message 2 of 3 in “[feature request] allow directly committing untracked files”
  1. Isaac Oscar GarianoAug 23, 2025
  2. brian m. carlsonAug 23, 2025
  3. Michal SuchánekAug 25, 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.