Git不会忽略文件 [英] Git won't ignore files
本文介绍了Git不会忽略文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一些我希望Git忽略的日志文件。他们都在:
/ Lead Services / logs /
在.getignore文件中,我尝试输入以下所有内容:
<$ c $主要服务/日志/
/牵头服务/日志/ **
我甚至尝试输入特定文件:
/ Lead Services / logs / LeadAcceptance-LocalDev.txt
无论我尝试什么,这些文件不断显示在资源管理器下的更改中。我在做什么错了?
解决方案您可以使用
git rm
从永久跟踪中排除文件。在你的本地仓库中,做git rm -r - 缓存日志/ *
然后
git add。
git commit -m排除跟踪中的日志
git push
从现在,git将不再跟踪日志文件夹。 另外,你可能会提到这个问题。
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?
解决方案You can use
git rm
to exclude file from tracking permanently. In your local repository, dogit 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.
这篇关于Git不会忽略文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文