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

git rm --cached

From
JXJing Xue <jingxue@digizenstudio.com>
Date
Nov 2, 2007, 02:17 UTC
Message-ID
<20071102021711.GA28703@fawkes.hq.digizenstudio.com>

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?

jingxue@fawkes:~/workspace/t1.git$ git status # On branch master # Changed but not updated: # (use "git add <file>..." to update what will be committed) # # modified: 1.txt # no changes added to commit (use "git add" and/or "git commit -a") jingxue@fawkes:~/workspace/t1.git$ git add 1.txt jingxue@fawkes:~/workspace/t1.git$ git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: 1.txt # jingxue@fawkes:~/workspace/t1.git$ git rm --cached 1.txt rm '1.txt' jingxue@fawkes:~/workspace/t1.git$ git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # deleted: 1.txt # # Untracked files: # (use "git add <file>..." to include in what will be committed) # # 1.txt jingxue@fawkes:~/workspace/t1.git$ git reset 1.txt: needs update jingxue@fawkes:~/workspace/t1.git$ git status # On branch master # Changed but not updated: # (use "git add <file>..." to update what will be committed) # # modified: 1.txt # no changes added to commit (use "git add" and/or "git commit -a")

Thanks.
-- 
Jing Xue
Next: Remi Vanicat
Message 1 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.