File Staged Content Different from HEAD

When I attempt to use git rm --cached I receive the following error:

error: the following file has staged content different from both the file and the HEAD:

I know that I can circumvent this error with git rm --cached -f <filename>. But normally when I unstage files with git rm --cached I do not get this error.

My question is what does it mean that the file has different staged content from the HEAD.


Typically, you get this status for an item that is "staged and modified", that is: it was modified in the first place, then it was staged and then it was modified again.

This status must be handled with care, otherwise lead to a lot of misconception if you now run a commit, since only staged changes will be committed (yes, even in the same file context, only staged changes will be committed), and not staged changes will be kept in the non-staging area for a future commit (if staged).


There are three places (for changes) worth to be distinguished:

  • in the file
  • changes in the file that you have already accepted to be part of the next commit, so called staged changes
  • changes in a file which were committed.

Only the first two matter, when you edit and commit files. Of the two (unstaged vs staged) git status shows you, what type of change you have.