.gitignore /文件夹与文件夹/

发布于 2024-11-05 03:09:20 字数 170 浏览 3 评论 0原文

之间有什么区别

/bin

在 .gitignore 中,使用和

bin/

,我将如何制作它以便删除某个文件,无论它在哪里?

*/*.ext

in .gitignore what is the difference between using

/bin

and

bin/

And how would I make it so that it removes a certain file, no matter where it is?

*/*.ext

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

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

发布评论

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

评论(3

つ低調成傷 2024-11-12 03:09:20

前导 / 将忽略模式锚定在树中特定 .gitignore 所在的位置。

尾随 / 表示模式仅匹配一个目录(以及该匹配目录中的所有文件)。

您可以同时拥有两者,例如 /bin/ 将仅匹配名为 bin 的目录,并且仅在 .gitignore 文件级别匹配。

简单的 *.ext 将匹配任何位于其出现的 .gitignore 文件级别或以下的以 .ext 结尾的文件。

A leading / anchors the ignore pattern at the point in the tree where the particular .gitignore resides.

A trailing / means that a pattern will only match a directory (and so all the files in that matching directory).

You can have both, e.g. /bin/ will match only a directory called bin and only at the level of the .gitignore file.

A simple *.ext will match any file ending with .ext anywhere at or below the level of the .gitignore file in which it appears.

明天过后 2024-11-12 03:09:20

我测试了这些案例以及更多案例,您可以在此处查看结果:

Results

编辑:根据下面@Dan Breen 的评论进行更正(谢谢!)

I tested the cases and also some more ones and here you can review the results:

Results

EDIT: Corrected according to @Dan Breen's comment below (thanks!)

对不⑦ 2024-11-12 03:09:20

后者将匹配任何其他子目录中的“xxx/bin”和“bin”。

回答您的编辑: *.ext 将处理存储库中以该扩展名结尾的所有文件。

The latter would match "xxx/bin" and "bin" in any other subdirectories.

Answer for your edit: *.ext would take care of all files in the repository ending w/ that ext.

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