如果 git 已经在跟踪这些文件,那么您将不得不将git rm
它们添加回来。
有可能另一个 .gitignore - 全局或该目录中的设置覆盖设置,请参阅手册页条目以获取优先级:
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.
o 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.
o Patterns read from $GIT_DIR/info/exclude.
o Patterns read from the file specified by the configuration variable core.excludesfile