问题
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:
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.
来源:https://stackoverflow.com/questions/35070091/git-wont-ignore-files