代码之家  ›  专栏  ›  技术社区  ›  Emile Dadou

gitignore-忽略不尊重特定掩码的文件夹

git
  •  -1
  • Emile Dadou  · 技术社区  · 4 月前

    我需要一个gitignore,它基本上忽略了所有文件夹,只有少数例外。 我有4个文件夹需要与git 3同步,其中3个文件夹的开头如下:

    RCU*/
    

    还有一个名为“工具”的文件夹。 例如: enter image description here

    我需要忽略所有文件夹,除了:

    • RCUFromUR
    • RCUToB360
    • RCUToUR
    • 工具

    除了这些文件夹之外的所有其他文件夹都需要忽略(并且将添加其他文件夹),有什么方法可以实现这一点吗?

    谢谢

    1 回复  |  直到 4 月前
        1
  •  1
  •   newstudent    4 月前
    # Ignore all directories except specific ones
    /*
    !/RCUFromUR/
    !/RCUToB360/
    !/RCUToUR/
    !/Tools/
    
    # If you want to exclude subdirectories from being tracked under the above folders, you can add these
    !/RCUFromUR/*/
    !/RCUToB360/*/
    !/RCUToUR/*/
    !/Tools/*/