删除特定文件夹,并通过.gitignore允许其他同名文件夹 [英] Remove specific folder and allowed others of same name through .gitignore
本文介绍了删除特定文件夹,并通过.gitignore允许其他同名文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在源结构的不同文件夹路径中有相同名称的文件夹(文档)。有些我想避免添加到Git仓库,而其他添加。如果我把下面的东西一切都删除了。
I've folders (documents) of same name in different folder paths of the source structure. Some I want to avoid add into the Git repo while other to add. If I put something like below everything removed.
documents/
我尝试了什么:
所以我添加了多条路径,并且有很多。< br $> b $ b
What I have tried:
So I've added multiple paths, and there a lot.
path/path/documents/
path/documents/
path/path/path/documents
我有一个简单的方法吗?
I there a simple way to do this?
推荐答案
如果你有很多文件目录要忽略,很少允许,你可以改用白名单:
If you have a lot of documents directories to ignore and few to allow, you could use whitelists instead:
# Ignore all documents directories
documents/
#Except these
!path/to/folder/documents/
!path/to/another/folder/documents/
这篇关于删除特定文件夹,并通过.gitignore允许其他同名文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文