Jigar Naik
Jigar Naik

Reputation: 1994

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

Upvotes: 0

Views: 48

Answers (1)

Manuel Schmidt
Manuel Schmidt

Reputation: 2427

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

Upvotes: 1

Related Questions