make git forget a file 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>