git忽略不忽略子目录? */labels/*?

发布于 2025-01-22 19:16:14 字数 688 浏览 3 评论 0原文

我试图忽略某个文件夹名称下的所有文件。但是,我有一个问题,我在树上的不同级别重复两次文件夹名称,这似乎使Gitignore不符合模式吗?

期望的结果: 我要做的是忽略最后一个标签文件夹下的所有文件。

尝试:

  • .gitignore适用于其他模式,因此文件本身很好,
  • 我尝试了模式:
  • */labels/*
  • **/labels/**
  • ** */labels/**/*
  • labels/*
  • labels/**
  • 标签

补充: 这样的目录树:

    └── Dir
        ├── labels
        │   └── folder1
        │       └── labels
        │           ├── file1.txt
        │           ├── file2.txt

# Current Git Ignore
*/labels/*

I am trying to ignore all files under a certain folder name. However, I have an issue where I repeat the folder name twice at different levels in the tree and this appears to make gitignore not honor the pattern?

Desired outcome:
What I am looking to do is ignore all file under the last labels folder.

Tried:

  • The .gitignore works for other patterns so the file itself is good
  • I have tried patterns:
  • */labels/*
  • **/labels/**
  • **/labels/**/*
  • labels/*
  • labels/**
  • labels

Supplemental:
Directory tree like this:

    └── Dir
        ├── labels
        │   └── folder1
        │       └── labels
        │           ├── file1.txt
        │           ├── file2.txt

# Current Git Ignore
*/labels/*

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文