stop tracking a file with git code example Example 1: make git forget a file git rm --cached <file> Example 2: make git forget a file git rm -r --cached <folder>