git 我应该提交 .gitignore 文件吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21600439/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Should I commit .gitignore file?
提问by trejder
After reading proper section of GitHub HelpI got completely lost. It says:
在阅读 了 GitHub 帮助的适当部分后,我完全迷失了。它说:
This file can be committedinto the repository, thus sharing the rule list with any other users that clone the repository.
可以将此文件提交到存储库中,从而与克隆存储库的任何其他用户共享规则列表。
Up until now, people I've been talking to about Git were telling me that ".gitingore
file mustbe committed or else its rules won't work!"
直到现在,我一直在谈论 Git 的人告诉我“必须提交.gitingore
文件,否则它的规则将不起作用!”
Every Git begginer's question: "Why .gitignore
rules are not applied?"
Could be answered with a simple: "Did you commit it?".
每个 Git 初学者的问题:“为什么.gitignore
不应用规则?”可以简单地回答:“你提交了吗?”。
And now, here comes the GitHub Help saying, that this file can becommited, but it isn't necessary
现在,GitHub 帮助说,此文件可以提交,但不是必需的
回答by emh
Yes, you can track the .gitignore file, but you do not have to.
是的,您可以跟踪 .gitignore 文件,但您不必这样做。
The main reason why people do that is so that everyone working on the project is ignoring the same files.
人们这样做的主要原因是每个参与项目的人都忽略了相同的文件。
Also see this: Should you commit .gitignore into the Git repos?