From: Junio C Hamano <gitster@pobox•com>
To: "Marcin Mikłas" <m.miklas@wszib•edu.pl>
Cc: git@vger•kernel.org
Subject: Re: basics - auto staging?
Date: Wed, 30 Apr 2025 09:44:04 -0700 [thread overview]
Message-ID: <xmqqbjsd38h7.fsf@gitster.g> (raw)
In-Reply-To: <10c9da5c-234c-4a40-bbff-91ba820dd970@wszib.edu.pl> ("Marcin Mikłas"'s message of "Wed, 30 Apr 2025 12:18:24 +0200")
Marcin Mikłas <m.miklas@wszib•edu.pl> writes:
> when I execute
> git commit file.txt
> (by listing file as argumentbut without the -a switch) for a file
> file.txt that I have made changes without staged them in the index,
> the changes are still commited.
> Is there a way to make this work like command
> git commit
> without committing the changes that are not staged in the index?
I do not think there is.
The "git commit --only [<pathspec>...]" mode (which is the default)
was introduced as a variant whose blast radius is much smaller than
the "git commit --include [<pathspec>...]" mode (which was the only
mode before "--only" was introduced), but what you seem to be after
is a mode that is even finer-grained one.
I do not offhand see a reason why such a mode should not exist. It
would be called the "git commit --cached [<pathspec>...]" mode (that
would be listed next to the existing "--only" and "--include" modes
in the documentation), by taking inspiration from the name of
another command "git diff --cached [<pathspec>...]" (i.e., use only
the contents already added to the index), if we were to add one.
prev parent reply other threads:[~2025-04-30 16:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-30 10:18 basics - auto staging? Marcin Mikłas
2025-04-30 16:44 ` Junio C Hamano [this message]
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=xmqqbjsd38h7.fsf@gitster.g \
--to=gitster@pobox$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=m.miklas@wszib$(echo .)edu.pl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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