git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git rm --cached

From
JHJan Hudec <bulb@ucw.cz>
Date
Nov 11, 2007, 14:05 UTC
Message-ID
<20071111140518.GA3847@efreet.light.src>
In-Reply-To
<20071102021711.GA28703@fawkes.hq.digizenstudio.com>
On Thu, Nov 01, 2007 at 22:17:11 -0400, Jing Xue wrote:
> In the following scenario, why do I have to run 'git reset' following
> 'git rm --cached 1.txt' to revert to exactly where I was before 'git add
> 1.txt'?  Shouldn't 'git rm --cached' have done that already?

The message in git-commit suggesting to use 'git rm --cached' to unstage is just plain wrong. It really should mention 'git reset'.

git rm, as the name suggests, *removes* the file. 

git reset, as the name suggests, reverts it to the state it was before (but, somewhat confusingly, with path limit only resets the index, so no --cached option there).

-- 
						 Jan 'Bulb' Hudec <bulb@ucw.cz>
Previous: Matthieu MoyNext: Jing Xue
Message 6 of 10 in “git rm --cached”
  1. Jing XueNov 2, 2007
  2. Remi VanicatNov 2, 2007
  3. Jing XueNov 2, 2007
  4. Remi VanicatNov 3, 2007
  5. Matthieu MoyNov 4, 2007
  6. Jan HudecNov 11, 2007
  7. replace reference to git-rm with git-reset in git-commit docJing Xue, Nov 12, 2007
  8. Junio C HamanoNov 12, 2007
  9. RESUBMIT: replace reference to git-rm with git-reset in git-commit docJing Xue, Nov 12, 2007
  10. Junio C HamanoNov 14, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.