Search code examples
eclipsegitgitignore

gitignore unable to ignore files under certain directories


How do I ignore all folders/files under audit directory?

I tried adding **/audit to .gitignore which is present in the root of my project. where .git is present but the file is still getting displayed in unstaged changes in eclipse. Is it because of the - in file name?

data/test/audit/portfolio-tnc/TEST-2019-04-22T03-20-31.json

Solution

  • If the file is already tracked by git you have to remove it from git index

    git rm --cached data/test/audit/portfolio-tnc/TEST-2019-04-22T03-20-31.json
    

    This will not remove the file but git won’t track it anymore.

    You can untrack a whole directory with

    git rm -r --cached data/test/audit