git:忽略除一个文件夹以外的所有文件夹的子文件夹
当前我有一个看起来像这样的存储库:
Git-Repository
└─── A
│ └─── X
│ └─── Y
└─── B
│ └─── X
│ └─── Y
└─── C
│ └─── X
│ └─── Y
│ ....
我想以某种方式编辑我的 .gitignore 文件忽略所有x子目录以外的所有x子目录。
这是我真正的回购的简单版本。实际上,我还有更多的文件夹和子文件夹,所以我无法一个一个目录。
edit1: 这是我想做的,但不起作用。 x子目录被忽略了,但是“ c”中的一个不是“ unignored”“”
X/
!C/X/*
currenty I have an repository that looks like this:
Git-Repository
└─── A
│ └─── X
│ └─── Y
└─── B
│ └─── X
│ └─── Y
└─── C
│ └─── X
│ └─── Y
│ ....
I want to edit my .gitignore file to somehow ignore all X subdirectories except the one in C directory.
It is important to mention that this is a simple version of my real repo. I actually have a LOT more folders and subfolders, so I cant set all the directories one by one.
Edit1:
This is what I am trying to do, but not working.
X subdirectory is being correcyly ignored, but the one in "C" isnt ""unignored""
X/
!C/X/*
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从 gitignore docs 。
这意味着
X/
仅匹配顶级X
目录。要匹配子目录,请使用通配符。
From the gitignore docs.
That means
X/
will only match a top levelX
directory.To match subdirectories, use a wildcard.