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

.gittributes文件应该在提交中吗?,git,merge,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 ending

我们正在做一个项目,有几个人有一台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
进入.gittributes

但是我是否应该将该文件提交到GitHub,以便其他使用Mac的人获得相同的设置

如果重要的话,我们正在为网站编码。(PHP、JavaScript文件等)


记录在案,我是唯一一个有Windows。。。那么,是的,我能做些什么呢?

首先,我建议读第一本

它建议您在存储库的根目录下或本地
.git
文件夹中签入
.gittributes
文件:
.git/info/attributes

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

在这种情况下,我倾向于将责任推到团队中“喜欢与众不同”的人身上——例如,如果除了一个开发人员之外,其他开发人员都在使用Mac,而另一个则在使用Windows,那就应该由违反规则的人来解决。这没有恶意,只是公平:-)

我添加了以下内容:

# 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

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

是的,我知道。但我已经阅读了文档,但无法确定该文件是否也应该在git服务器上。你是说在git服务器上还是签入了?我对git不是很好,因为我刚刚发现了它。但是,当我尝试进行提交时,它会要求我将文件上载到服务器,我做到了。。它实际上解决了问题:那么我该怎么办呢?xD我应该回答我自己的问题还是什么?