Git:列出应忽略但不能忽略的文件 [英] Git: List files that should be ignored, but are not
问题描述
注意:
这不是要像git rm -r --cached . && git add .
这样固定,我实际上只希望列出文件.
This is not about fixing like git rm -r --cached . && git add .
I actually want to be able to list the files only.
原因:
有时候,当我编辑.gitignore并忘记上面的命令时,我最终得到的文件仍在存储库中,但应该被忽略.
Sometimes when I edit my .gitignore and forget the above command I end up with files that are still in the repository, but should have been ignored.
内容:
我要完成的工作是编写一个Shell脚本,该脚本能够列出我的文件系统上所有已被should
忽略但仍然存在的文件.
What I want to accomplish is to write a shell script, that is able to list all files on my filesystem that should
have been ignored, but are still present.
结果:
最后,我想将其实现到一个持续集成服务器中,该服务器将检查.gitignore
中的规则是否与存储库中的文件匹配.
In the end, I want to implement it to a continuous integration server, that is going to check if the rules from .gitignore
match the files that are inside the repository.
有什么办法可以手动解析.gitignore
?
Is there any way to parse the .gitignore
by hand?
推荐答案
git ls-files --cached --ignored --exclude-standard
这篇关于Git:列出应忽略但不能忽略的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!