From: "Adam T via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
"Elijah Newren" <newren@gmail.com>,
"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>,
"Adam T" <admr0805@gmail.com>
Subject: [PATCH 0/2] rm: revisiting --staged and --worktree
Date: Sat, 05 Dec 2026 07:19:02 +0000 [thread overview]
Message-ID: <pull.2349.git.1796455144.gitgitgadget@gmail.com> (raw)
RFC: I'd like feedback on some design choices below.
rm uses --cached while some (newer) commands like restore use --staged. In
[1], a discussion raised this confusion, advocating for an alias. Junio
objected, saying it adds nothing unless rm gets a working-tree-only target.
This series introduces a working-tree-only target for rm and aims to restart
conversations about a wider push to --staged in user-facing commands (see
question #2 below). It also makes --cached an alias for --staged & preserves
existing default behaviors.
Open questions:
1. How to handle git rm --worktree attempts? There are three approaches:
(1) remove the working tree & keep .gitmodules; (2) remove the working
tree & remove the .gitmodules entry; (3) refuse the request. (1) could
work but it duplicates git submodule deinit, (2) modifies the index,
which is probably wrong for a flag that aims to be "worktree-only." I
chose (3) and added a hint to use git submodule deinit instead since
that's the more explicit command.
2. In [2], Duy stated:
> * The patch 'rm --staged' is dropped. It could come back. But if it
> does, it should be in a series where commands that take
> --cached/--index will now take both --staged/--worktree. Those are
> 'rm', 'apply', 'check-attr', 'grep', 'diff' and maybe 'ls-files'.
While this series only introduces the feature for rm, I generally agree
with this. It makes --worktree and --staged the standard, which reduces
the friction you'd expect while using Git. I have the bandwidth to pick
them up, but I wanted to draw some feedback before attempting it.
[1] https://lore.kernel.org/git/xmqq4l73ztxf.fsf@gitster-ct.c.googlers.com/
[2] https://lore.kernel.org/git/20190425094600.15673-1-pclouds@gmail.com/
adam torres encarnacion (2):
rm: add --staged and --worktree
rm: relax --worktree-only restrictions
Documentation/git-rm.adoc | 41 ++++++++++++--------
builtin/rm.c | 71 ++++++++++++++++++++++++-----------
t/t3600-rm.sh | 79 +++++++++++++++++++++++++++++++++++++--
3 files changed, 150 insertions(+), 41 deletions(-)
base-commit: 566b6997dd4710b625c0882cf10a7443bf52d183
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2349%2F0xABAN%2Frm-staged-worktree-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2349/0xABAN/rm-staged-worktree-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/2349
--
gitgitgadget
next reply other threads:[~2026-12-05 7:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-05 7:19 Adam T via GitGitGadget [this message]
2026-12-05 7:19 ` [PATCH 1/2] rm: add --staged and --worktree adam torres encarnacion via GitGitGadget
2026-12-05 15:15 ` D. Ben Knoble
2026-12-05 16:32 ` Adam
2026-12-05 7:19 ` [PATCH 2/2] rm: relax --worktree-only restrictions adam torres encarnacion via GitGitGadget
2026-12-05 15:15 ` [PATCH 0/2] rm: revisiting --staged and --worktree D. Ben Knoble
2026-12-05 16:32 ` Adam
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=pull.2349.git.1796455144.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=admr0805@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=newren@gmail.com \
--cc=pclouds@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.