有一个新的 .gitignore 告诉我是否有任何文件已经与跟踪的文件匹配

发布于 2024-10-01 06:19:30 字数 185 浏览 0 评论 0原文

有没有办法解析 .gitignore 并告诉我是否已经有一些与忽略匹配的文件,以便我知道删除它们或更改我的 .gitignore?

例如,我有 git 跟踪我的 imgs 目录,我希望忽略所有 Windows Thumbs.db,并告诉我存储库中是否还有剩余内容被跟踪以便我可以删除它们。

is there a way to parse a .gitignore and tell me if i already have some files that match the ignores so that i know to remove them or change my .gitignore?

example is that i have git tracking my imgs directory, and i wish to ignore all of windows Thumbs.db, and also tell me if I have any left over in my repository being tracked so that i can remove them.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

土豪我们做朋友吧 2024-10-08 06:19:30

尝试 git ls-files --ignored 。您可能需要使用这些选项,但 ls-files 是编写使用排除模式匹配文件的脚本的正确起点。

Try git ls-files --ignored. You might have to play with the options, but ls-files is the right starting point for writing a script that matches files using the excludes patterns.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文