Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法解析 .gitignore 并告诉我是否已经有一些与忽略匹配的文件,以便我知道删除它们或更改我的 .gitignore?
例如,我有 git 跟踪我的imgs目录,我希望忽略所有 windows Thumbs.db,并告诉我是否在我的存储库中留下任何被跟踪的内容,以便我可以删除它们。
imgs
Thumbs.db
试试git ls-files --ignored。您可能必须使用这些选项,但这ls-files是编写使用排除模式匹配文件的脚本的正确起点。
git ls-files --ignored
ls-files