我们正在开发一个项目,几个人拥有 Mac,而我在 Windows 上运行。我们在换行方面遇到了一些问题。
我在 GitHub 上读到我可以添加以下内容:
# Set default behaviour, in case users don't have core.autocrlf set.
* text=auto
# Explicitly declare text files we want to always be normalized and converted
# to native line endings on checkout.
*.c text
*.h text
# Declare files that will always have CRLF line endings on checkout.
*.sln text eol=crlf
# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
进入.gitattributes
但是我应该将该文件提交到 GitHub,以便其他拥有 Mac 的人获得相同的设置吗?
如果重要的话,我们正在编写网站。 (PHP、JavaScript 文件等等)。
郑重声明,我是唯一使用 Windows 的人...所以,是的,我能做什么?
最佳答案
首先,我建议阅读 documentation首先。
它建议检查存储库根目录下的 .gitattributes
文件或本地 .git
文件夹中的文件:.git/info/attributes
.
后一个选项的影响可能最小(如果您是唯一的 Windows 用户)。
对于这种事情,我倾向于将责任归咎于团队中“喜欢与众不同”的人 - 例如例如,如果除一名开发人员之外的所有开发人员都使用 Mac,而另一名开发人员则使用 Windows,那么这实际上应该由那些违背常规的人来解决。这没有恶意,只是公平:-)
关于git - .gitattributes 文件应该在提交中吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15090102/