gpt4 book ai didi

git - 子文件夹中的多个 .gitignore

转载 作者:行者123 更新时间:2023-12-01 00:15:21 25 4
gpt4 key购买 nike

是否可以在子文件夹中有一个 .gitignore 文件,以便我可以更好地控制我需要忽略的内容而不影响更大的“基本”gitignore?

例如,有根 .gitignore,但不是说在该文件中写入/path/to/folder,而是在我的文件夹中有另一个仅适用于该文件夹及其子文件夹的 .gitignore?

最佳答案

答案是:是的,可以有 .gitignore子文件夹中的文件。
Documentation :

When deciding whether to ignore a path, Git normally checks gitignore patterns from multiple sources, with the following order of precedence, from highest to lowest (within one level of precedence, the last matching pattern decides the outcome):

  • Patterns read from the command line for those commands that support them.

  • Patterns read from a .gitignore file in the same directory as the path, or in any parent directory, with patterns in the higher level files (up to the toplevel of the work tree) being overridden by those in lower level files down to the directory containing the file. These patterns match relative to the location of the .gitignore file. A project normally includes such .gitignore files in its repository, containing patterns for files generated as part of the project build.

  • [...]


谢谢 alfunx

关于git - 子文件夹中的多个 .gitignore,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53208235/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com