From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.219.53 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796455147; b=GxiFUJCTu0wDQJ/tPjsqXb7HaI7iJR4jbO36XUpWV5MvuwvyyBr8tN0XbJh2T8SeQNML Zl6Ao2AelE+ih2PAmfep0r21maxpet975QvjBpSjXBZcMYJbJMD4UQ0xqT8E7NlE0yMHb RRNIVMNmJWjbhIlbxw9xWZqjWrQWbOvd409gQqMvlFWXNclbvtZ2BJo0jDUcPtA33LO3N 2MgUQ4WEO0Mz+DLr+PerZ51VgSNXlDekb9wmGamPDmasJooXuW9a3HOirO5kH0oXkbGHa yY14aHzBZUmEnQTyLQuh3kImfYZSVOMekFM1PWzQcMUp4HcVyY+M743RKpdFgz39Vhg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796455147; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:Message-Id:From:Date: Subject:Fcc:Content-Type:Content-Transfer-Encoding:MIME-Version:To: Cc; bh=gGtilyoGQ5TUm7J10VzMurcFoMiCzd1ePlBgxwSPY0U=; b=byLLAZPf2CvCwRYjtukYtTvN0SaxpRPmi9CLeG65F+rsMZCx5B+x9TQYfgv/BKjHVGr0 pMDTVdngaVNKyGLBZWNMuxH5fY9RnEy/nYx/Nqcy+r8uLVREPACnYN7kbMUkTNdZL3h/M 6U2Tp7+EjqDYGh/LPV7NeQhiDHlo/9INyehuZyoPIhcW98ZOEj84jU+UkoVbGRS8RB5Yb 76w1lT28iq0lJ49HOWgAgVr8decpdCKcfSVMU49BO3Fa4CXxctDk708uYnUQJeEIImyMn +SGKYMdLQIZ8pc5t+aTt9HfQB26KUmnqEL1f+NPi/xi0LuvSoge/9TCmoxqtcf/XB9Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=Q2H1tfvO; arc=none smtp.remote-ip=209.85.219.53 Received: from mail-qv1-f53.google.com (mail-qv1-f53.google.com [209.85.219.53]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DB802606A32F for ; Sat, 5 Dec 2026 07:19:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org DB802606A32F Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=Q2H1tfvO Received: by mail-qv1-f53.google.com with SMTP id 6a1803df08f44-9213f004a14so26107896d6.3 for ; Fri, 04 Dec 2026 23:19:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796455146; x=1797059946; darn=vger.kernel.org; h=cc:to:mime-version:content-transfer-encoding:content-type:fcc :subject:date:from:message-id:from:to:cc:subject:date:message-id :reply-to:content-type; bh=gGtilyoGQ5TUm7J10VzMurcFoMiCzd1ePlBgxwSPY0U=; b=Q2H1tfvOqeG3BND734/LNBOtdrCzwKtnhxXv1F1YeNbvfoOomt14YYxfIofcpw4tPp FDZPAG/WEU2KMhNYrZGwvvPako9wPv5ib1VAqNOj4Xp5hHOQOcj76j3HXKSMR9K6qgPb AezG9+a00wmpQUY5P9ssXXFeQhXkcQE3epWOIS6+JQf9olQe/8ZmquukVTE7yjA0IBNZ 4QKhIE+B7WPh4OT89tnesObZX4qpwOATs44Udn/iBbf+4PWEYkvhkWroAfnAIeLpseeg l6kerBr7TDdzf3Y5Wf56VGly+2HEDBZNUrcW8gF/9zeKT1+BTjj6zFs4NvDJBkqx5nd8 2lng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796455146; x=1797059946; h=cc:to:mime-version:content-transfer-encoding:content-type:fcc :subject:date:from:message-id:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to:content-type; bh=gGtilyoGQ5TUm7J10VzMurcFoMiCzd1ePlBgxwSPY0U=; b=JSJpMH1K3Qztw5UAznKNmsVNzVsEASF4Kc+SzlNUJmfjIQcyH/aphUmdmbvmmfBooH fCpSfopImShKYd4IunafYcH8ce0PpDjKhkuqq6XzO2OrM83RuEi4DkrShuKzYaD57Eq/ qkv4TbtIiNsjwW3HDJ3XJnMmp7ULt5V4K8/BVdix75+N8StdHdljEIit1q4KXKRcXZ07 JC9VLiu50dBs6Ab69TyYwxVSALJ+iLWVn+899hZEmE6Ge6tHmTJcq1j87wdTrxySyw7W 3GpQZMMJvZaKqSSlOhR6l/4J/eNaOPYlFTAf2DpweCYv+aRDxtM2FGy66xbCHpl2bhXS GNmA== X-Gm-Message-State: AB4q+uH0qD+iwRfwZuMn9yJMJbibVsYBR7lnMS9+YBXhmSV/Fy5+bFhe Y2hbVFvutC5ZOmps5xHi9750/Ag2uDYgzHc80BFmNEeUUSOMtL4UKWKPa67UQg== X-Gm-Gg: AZFdTZdSp+62dHRd1WOZb5hcTiJnYWmR6k169Ilo29M2Farh8h3TMZvY8n/F9E5I1Hc tw1u4WIsXZRn9PYi7zrDy1csQPruo5dMUbyasLQq2nnb4u+3omFzWGREI6hbr11XwkmSYfPRFrZ kgYwYbwC4qKHWl4M3IdZY3qEdKivv0WLrIZTiW6+6obnFpe1fKAPk00VMoCIlXLto6TA966CqPg sD//3Y7YksSujSaKPWPs33rtkN4yEiiuLxYs0YQ8ieKXJ1Kp88LibHBpGSllAePu8HzrmFilTD6 PM3aauN07SmDSgUH4v1AOfn68E8F2mHNs6NWktT854fwMVcBKVbZ43h0vKbgXz/VHldIpOlWZgo Vs3DVnKyZNFew7gLvO1eam0u7iyCUcERF/NpNW6wZfItk66hWa20JNesvpYuzuRvRSbE81vSl2d JNHKoJipuG4Uvt6h4h16kOOY1XmYGRR7fSCg0vXQIHoxzm3uZUiNvNxxgnuXYNPiFMgUatZaoPw BSMc1eAiUDz0jiiTzTmoPHbCZiFABPk6g3r1iD1MTB5DWExLjXAKDgdlEBlYKLLbdqrUPkN0p3P 7WQPq4Sr8jYn1FJRyeCn7042SAeH358p X-Received: by 2002:a05:6214:dcf:b0:921:366c:7b33 with SMTP id 6a1803df08f44-921e244ef6bmr70725886d6.19.1796455145789; Fri, 04 Dec 2026 23:19:05 -0800 (PST) Received: from [127.0.0.1] ([20.81.230.132]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-921e0593e0dsm41521956d6.29.2026.12.04.23.19.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2026 23:19:05 -0800 (PST) Message-Id: From: "Adam T via GitGitGadget" Date: Sat, 05 Dec 2026 07:19:02 +0000 Subject: [PATCH 0/2] rm: revisiting --staged and --worktree Fcc: Sent Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Mailing-List: git@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 To: git@vger.kernel.org Cc: Junio C Hamano , Elijah Newren , =?UTF-8?Q?Nguy=E1=BB=85n_Th=C3=A1i_Ng=E1=BB=8Dc?= 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