我在管理我正在开发的网站的 .gitignore
文件时遇到问题。我将我的网站存储在多个存储库中,这些存储库需要 stash 或从 git 中显示不同的文件。例如:我不希望我的 Github 存储库存储图像或数据库信息。另一方面,我的生产服务器需要查看这两个文件,但我可能不需要用于开发目的的某些文件。
管理多个存储库的 .gitignore
的最佳方法是什么?
最佳答案
.git/info/exclude
是仅限本地的 .gitignore
如果您将模式存储在那里,它将仅适用于该特定克隆。 .gitignore
但是,如果提交到存储库,则会同等影响所有存储库。
How do I tell git to ignore files?
.git/info/exclude is local to your repository only, and not shared by others who might fetch from your repository.
.gitignore is more commonly used, as it can be checked into the repository and thereby automatically shared with all users of the project.
关于git - 单个项目中的多个 .gitignore,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11498512/