.gitattributes文件应该在提交中吗?

Muq*_*ito 10 git merge

我们正在开发一个项目,有几个人拥有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
Run Code Online (Sandbox Code Playgroud)

进入.gitattributes

但是我应该将该文件提交给GitHub,以便其他Mac用户获得相同的设置吗?

如果重要,我们正在编码网站.(PHP,JavaScript文件和东西).

为了记录,我是唯一一个拥有Windows的人...所以是的,我该怎么办?

ben*_*ape 13

首先,我建议先阅读文档.

它建议检查.gitattributes存储库根目录或本地.git文件夹中的文件:.git/info/attributes.

后一个选项可能影响最小(如果您是唯一的Windows用户).

有了这种事情我倾向于把责任推谁"喜欢是不同的"在球队-例如,如果所有,但开发者之一正在使用Mac的,另一种是使用的是Windows例如,它应该真的是到那个反对谷物的人要理清楚.这没什么恶意的,只是公平的:-)


Muq*_*ito 7

我补充说:

# 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
Run Code Online (Sandbox Code Playgroud)

并将其提交给GitHub服务器.所以每个人都解决了这个问题.