Jan 17, 2022

How to fix git not ignoring files or folder that is just added to the .gitignore file?

If a file is already tracked by git and if you try to remove it by adding it to the .gitignore file, it may sometimes not ignore the file properly.

By

Muthukumar

If the file or folder you try to ignore is already tracked by the git, then you have to remove it from the tracking.

To remove the file from tracking, run the following command.

git rm <your-file-name-with-extension> --cached

To removed the folder from tracking, run the following command.

git rm <your-folder-name> --cached -r

Here, -r represent recursive.

Continue Reading