简体   繁体   English

忽略所有期望.gitignore中的所有子文件夹/文件

[英]Ignore everything expect all subfolders / files in .gitignore

I want to allow all files (and their parent folder) within a specific directory of my eclipse project. 我想允许我的Eclipse项目的特定目录中的所有文件(及其父文件夹)。

I want to allow all files within the libs folder 我想允许libs文件夹中的所有文件

Example

RootFolder
    EclipseProjects
        ProjectOne
            build
            src
            WebContent
            libs
                lib1
                    file.jar
                    file1.jar
                lib2
                    file3.jar
                    file4.jar
                    etc.jar

In the root of git I have my .gitignore, which includes many variations on the same folder/files 在git的根目录下,我有.gitignore,其中包括同一文件夹/文件上的许多变体

I'm trying to just allow the jars to see if that will work too. 我正试图让罐子看看是否也可以。

#Relevant lines of .gitignore
#Ignore
*.jar

#Allow
!libs/
!libs/*
!libs/*/*
!libs/**.jar
!/libs/
!/libs/*
!/libs/*/*
!/libs/**.jar
!libs/lib/*.jar

I cannot get this to work, any suggestions? 我无法解决这个问题,有什么建议吗?

这对我有用

!**/libs/**/*

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM