From: Junio C Hamano <gitster@pobox.com>
To: "Kristoffer Haugsbakk" <kristofferhaugsbakk@fastmail.com>
Cc: "Jon Forrest" <nobozo@gmail.com>, git@vger.kernel.org
Subject: Re: "git commit -a" Doesn't Add New Files. Why?
Date: Wed, 28 May 2025 14:16:03 -0700 [thread overview]
Message-ID: <xmqqzfewqvvw.fsf@gitster.g> (raw)
In-Reply-To: <09518eac-948e-46be-9cd2-64304e78af81@app.fastmail.com> (Kristoffer Haugsbakk's message of "Tue, 27 May 2025 18:43:10 +0200")
"Kristoffer Haugsbakk" <kristofferhaugsbakk@fastmail.com> writes:
> I think it makes sense to only include tracked files. But (in any case)
> when the option was added[1][2] it meant:
>
> git-diff-files --name-only | xargs git-update-cache
> git commit
>
> And this `git diff-files --name-only` prints tracked files which
> are changed.
>
> Given that you apparently had to pipe filenames to a command that
> updates the cache (obsolete for: index[2]) and then do a commit I will
> assume that mistakes were more costly. What if you piped in all changed
> tracked files and untracked files? And you forgot to ignore your build
> artifacts? That’s more things you have to undo.
But .gitignore is your friend these days.
Given that a precursor of modern "gitignore" did not appear until
fee88256 (ls-files: rework exclude patterns., 2005-07-28), and "git
status" started to pay attention only at ba966b95 (Teach
git-status-script about git-ls-files --others, 2005-08-26), it is
understandable that nobody was enthused about grabbing any new files
out of the working tree back then.
And unless you are total newbie, you would know that you create a
new file far far less often than you modify an existing file, so you
would be more careful about avoiding to include new and unwanted
files than forgetting to add new and necessary files.
next prev parent reply other threads:[~2025-05-28 21:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-27 16:03 "git commit -a" Doesn't Add New Files. Why? Jon Forrest
2025-05-27 16:31 ` Nico Williams
2025-05-28 22:24 ` Junio C Hamano
2025-05-28 23:06 ` Jon Forrest
2025-05-27 16:43 ` Kristoffer Haugsbakk
2025-05-28 21:16 ` Junio C Hamano [this message]
2025-05-28 23:34 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqzfewqvvw.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=kristofferhaugsbakk@fastmail.com \
--cc=nobozo@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).