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

git diff and file deleted from the cache

From
Remi Vanicat <vanicat@debian.org>
Date
Nov 11, 2007, 12:43 UTC
Message-ID
<876409j6kx.dlv@vanicat.homelinux.org>
The manual of git-diff tell me that :
  git-diff [--options] <commit> [--] [<path>...]
      This form is to view the changes you have in your working tree
      relative to the named <commit>. You can use HEAD to compare it with
      the latest commit, or a branch name to compare with the tip of a
      different branch.
So the following seem strange :
$ echo foo > bar
$ git commit -m "committing bar" -a
Created commit 074893b: committing bar
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 bar
$ git rm --cached bar
rm 'bar'
$ git diff HEAD --
diff --git a/bar b/bar
deleted file mode 100644
index 257cc56..0000000
--- a/bar
+++ /dev/null
@@ -1 +0,0 @@
-foo

I excepted the diff to be empty, as HEAD and the working directory are
synchronized, I've only modified the cache.
-- 
Rémi Vanicat
Message 1 of 1 in “git diff and file deleted from the cache”
  1. Remi VanicatNov 11, 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.