Git won't ignore files

2019-03-01 08:16发布

I have some log files that I want Git to ignore. They are all in:

/Lead Services/logs/

In the .getignore file, I have tried entering all of these:

/Lead Services/logs
/Lead Services/logs/
/Lead Services/logs/*
/Lead Services/logs/**

I've even tried to enter specific files:

/Lead Services/logs/LeadAcceptance-LocalDev.txt

No matter what I try, these files keep showing up in Team Explorer under "Changes". What am I doing wrong?

1条回答
你好瞎i
2楼-- · 2019-03-01 08:59

You can use git rm to exclude file from tracking permanently. In your local repository, do

git rm -r --cached logs/*

then

git add .
git commit -m "Excluded logs from tracking"
git push

From now on, the git won't track the logs folder, any more. Also, you may refer to this question.

查看更多
登录 后发表回答