Updating gitignore

How to refresh the file index so the files I want ignored get ignored ?

Signal file

git rm --cached filename

to undo use git add filename

Redo the whole .gitignore

First commit any outstanding code changes, and then, run this command:

git rm -r --cached .

This removes any changed files from the index(staging area), then just run:

git add .

Commit it:

git commit -m "redo .gitignore"

kudos to takeshin@stackoverflow