.gitignore is not working?

While working in team, I always find the complain about git from my team members(specially from new developer):

“I just added a file to .gitignore but the changes from those files also appears when I see the changes with command: git diff”

I think this is not only my team member problem. Most of new developer face this problem. So I thought to write few words on this topic.

The main problem behind it is, most of new developer forgot to clear cache before they commit changes related to .gitignore file.

So we need to clear cache and stage and commit the changes.

Here is simple steps which will solves this problem.

git rm -r --cached .
git add .
git commit -m "fixed untracked files"

Hope it will help you if you are facing same problem.


One response to “.gitignore is not working?

Leave a Reply

Your email address will not be published. Required fields are marked *

Enter Captcha Here : *

Reload Image