我尝试将一个临时但不是那么临时的文件添加到 Git 存储库而不将其添加到索引。我不想将它添加到 .gitignore 或像 ~/.gitignore_global 这样的文件,因为它只会适用于特定的存储库。
有没有什么方法可以忽略要在特定存储库中编制索引的文件而不索引我想忽略它的事实?
最佳答案
您可以将忽略模式放在 $GIT_DIR/info/exclude
中,以便它仅适用于存储库而不是每个存储库。
来自手册:
Patterns which are specific to a particular repository but which do not need to be shared with other related repositories (e.g., auxiliary files that live inside the repository but are specific to one user’s workflow) should go into the $GIT_DIR/info/exclude file.
关于git - 如何在没有 .gitignore 或全局设置的情况下忽略 Git 存储库中的文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8482315/