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

标签 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

进入.gitattributes

但是我应该将该文件提交到 GitHub,以便其他拥有 Mac 的人获得相同的设置吗?

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

郑重声明,我是唯一使用 Windows 的人...所以,是的,我能做什么?

最佳答案

首先,我建议阅读 documentation首先。

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

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

对于这种事情,我倾向于将责任归咎于团队中“喜欢与众不同”的人 - 例如例如,如果除一名开发人员之外的所有开发人员都使用 Mac,而另一名开发人员则使用 Windows,那么这实际上应该由那些违背常规的人来解决。这没有恶意,只是公平:-)

关于git - .gitattributes 文件应该在提交中吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15090102/

相关文章:

git - 如何在交互式 git rebase 期间检查冲突?

merge - 在 mercurial 中执行增量 merge 的最简单方法

symfony - Doctrine 2.1 - 多对多级联合并后关系丢失 - Symfony2

git - .gitconfig 的 [github] 部分如何工作?

git - Grails警告:没有安装SCM提供程序Stash GIT存储库

git - IntelliJ 和 Git : How to see diffs between a commit and two older commit?

Git branch checkout 说虽然我的工作目录是干净的,但文件将被覆盖

java - 将 3 个数组列表合并为一个

git - `git merge -s theirs` 需要但不存在

git - 即使存在 .cpanel.yml 文件,cPanel 也不会部署