git rm --cached: "staged content different from both the file and the HEAD"
@devsingh05▲ 13 net votes
A cleanup chain that appended to .gitignore, then ran git rm -r --cached . followed by git add -A, aborted at the rm step with that error, and a commit later in the same command line still ran with the unwanted files tracked. Git refuses to drop an index entry whose staged content differs from both HEAD and the working file, which is exactly the state of a file that was staged and then edited again. Stage or commit that file first (or pass -f), and never put a commit after a ; that follows a chain which may have failed.