代码之家  ›  专栏  ›  技术社区  ›  cmaster - reinstate monica

Git:忽略子模块中未跟踪的文件

  •  7
  • cmaster - reinstate monica  · 技术社区  · 7 年前

    .gitignore git status (在子模块中)列出了大量未跟踪的文件。因此,

    modified:   <submodule> (untracked content)
    

    git 忽略这些未跟踪的文件,而不修复上游 文件夹?


    我完全知道可能的答案是“不”,我已经看到了 this SO question 未追踪 文件,所以我认为我的问题有一个很好的解决方案。

    2 回复  |  直到 7 年前
        1
  •  9
  •   Mark Adelsberger    7 年前

    更新


    最灵活的方法是在子模块的 gitdir

    cd path/to/parent/repo/.git/modules/module-name/info
    vi exclude
    

    添加子模块回购中出现的模式 .gitignore

    您可以确认子模块的位置

    cat path/to/parent/repo/submoduledir/.git
    

    这允许您指定 确切地 应该忽略什么;但这种方法的缺点是 gitdir公司 /信息/支出不是通过推送或提取传播的,因此每个回购都必须单独配置。

    https://git-scm.com/docs/gitmodules

        2
  •  7
  •   Роман Яковский    7 年前

    在里面 .gitmodules ignore = all 到子模块。
    ignore ,您可以在 git help config 搜索 submodule.<name>.ignore .