git ignore untracked files - How to make Git “forget” about a file that was tracked but is now in .gitignore?

git rm --cached / git / gitignore / git-rm

There is a file that was being tracked by git, but now the file is on the .gitignore list.

Akshay Sood

Answer #1

To clear your repo, use:

git rm -r --cached .

Step 3: Re add everything

git add .

Step 4: Commit

git commit -m ".gitignore fix"