Git development
 help / color / mirror / Atom feed
* [PATCH 0/2] rm: revisiting --staged and --worktree
@ 2026-12-05  7:19 Adam T  via GitGitGadget
  2026-12-05  7:19 ` [PATCH 1/2] rm: add " adam torres encarnacion via GitGitGadget
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Adam T  via GitGitGadget @ 2026-12-05  7:19 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Elijah Newren,
	Nguyễn Thái Ngọc Duy, Adam T

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-12-05 16:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-05  7:19 [PATCH 0/2] rm: revisiting --staged and --worktree Adam T  via GitGitGadget
2026-12-05  7:19 ` [PATCH 1/2] rm: add " 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox