【问题标题】:Recursively ignore directory by name using .tfignore使用 .tfignore 按名称递归忽略目录
【发布时间】:2018-09-27 15:04:30
【问题描述】:

我有以下文件夹结构:

foo1/
  node_modules/
foo2/
  node_modules/
  bar/
    node_modules/
.tfignore

单个.tfignore 文件位于根目录中。

我应该添加什么到.tfignore 以便递归地忽略node_modules 目录,无论它们在目录层次结构中的什么位置?


有很多与我类似的问题。但是所有的都很宽。我想保持简单。请不要使用“待更改”提出任何建议。我只需要.tfignore中的一行

【问题讨论】:

  • 你试过什么?您是否尝试过将node_modules 添加到您的.tfignore?当您这样做时,您的待定更改是什么样的?
  • @EdwardThomson,我觉得很尴尬,但你是对的。简单的node_modules 做到了。我试过 \**\node_modules\、\*\node_modules\ 并没有用。
  • @EdwardThomson 您可以发布您的答案,我会接受。以防万一有人像我一样傻。
  • 无需感到尴尬 - 我不记得 .tfignore 是如何工作的,然后我发布了该代码。

标签: tfs tfs-2015 tfignore


【解决方案1】:

.tfignore 文件将忽略 all 子目录中的给定模式(除非另有说明)。它会忽略具有给定名称的文件 文件夹。对于文件夹,它将递归应用。

因此,.tfignore 带有:

node_modules

将忽略文件系统层次结构中名为 node_modules 的任何文件夹,并递归地忽略它们。

【讨论】:

  • 如果我只想忽略模式 bar/node_modules 应该怎么写?
猜你喜欢
  • 1970-01-01
  • 2011-01-03
  • 2017-07-21
  • 1970-01-01
  • 2013-11-18
  • 2022-01-25
  • 2019-10-25
  • 1970-01-01
  • 2013-08-18
相关资源
最近更新 更多