gitignore文档中的这句话怎么理解了?

发布于 2022-09-13 00:40:32 字数 360 浏览 32 评论 0

If there is a separator at the beginning or middle (or both) of the pattern, then the pattern is relative to the directory level of the particular .gitignore file itself. Otherwise the pattern may also match at any level below the .gitignore level.

https://git-scm.com/docs/gitignore

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

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

发布评论

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

评论(1

つ低調成傷 2022-09-20 00:40:32

简单的说,就是当 .gitignore 中配置的路径有 / 开头时,就会从 .gitignore 文件的位置匹配,当没有时,就会在子目录中也匹配。

D:.
├─package-a
│  ├─package-aa
│  │  └─_vendor
│  └─_vendor
└─_vendor
  • .gitignore 无内容下 add

image.png

  • .gitignore 内容为 _vendor 时 add

image.png

  • .gitignore 内容为 /_vendor 时 add

image.png

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