代码之家  ›  专栏  ›  技术社区  ›  pistacchio

.gitignore中的异常

  •  169
  • pistacchio  · 技术社区  · 15 年前

    如何向.gitignore添加异常,例如“忽略所有.dll文件” myfile.dll“?

    4 回复  |  直到 5 年前
        1
  •  310
  •   Ben James    15 年前

    ! 要否定这种模式:

    *.dll
    !myfile.dll
    
        2
  •  197
  •   cubuspl42    11 年前

    MyFolder/*
    !MyFolder/CoolFile.txt
    

    不会 工作:

    MyFolder/
    !MyFolder/CoolFile.txt
    
        3
  •  42
  •   Anver Sadhat    4 年前


    !src/main/resources/archetype-resources/**/*

    你也可以忽略 带图案的嵌套文件夹 喜欢

    !**/src/test/resources/**/*

    要快速创建.git文件,请尝试 gitignore.io

        4
  •  9
  •   kamayd    9 年前

    .gitignore 文件以分层方式协同工作以实现您的目标。 在根级别,您可能有:

    *.dll
    

    在包含 myfile.dll 你可以再加一个 .git忽略 像这样归档:

    根/lib/folderwithMyFiledll

    !myfile.dll
    

    here

        5
  •  5
  •   Peter Mortensen icecrime    5 年前

    /modules 我想忽略的,除了世界上的一切 /modules/custom 文件夹。这对我有用。现在我的自定义模块将同步到GitHub。

    /modules/*
    !/modules/custom/