$ ./guess_the_languageGit
Git · medium · #5

debug.log is still reported as modified because it was already tracked. Which command stops tracking it but keeps the file on disk?

$ echo "debug.log" >> .gitignore
$ git status --short
 M debug.log
?? .gitignore
  1. git rm --cached debug.log
  2. git rm debug.log
  3. git update-index debug.log
  4. git restore debug.log
Ignore rules only affect untracked files. git rm --cached removes the file from the index only, so it becomes untracked and the ignore rule applies.
Play Git ▸