使用代码分发git配置 [英] Distributing git configuration with the code
问题描述
在试图为开发人员标准化平台时,我的需求之一是提交 .git / config
,以便每个人都拥有相同的CRLF配置,而不会忘记手动设置它。
我如何设置它?
我有点担心这对 autocrlf
的负面影响。如果它不起作用,为什么不删除此功能?这个功能的制造者或者被误解了,或者他们做了一个失败的实验,应该删除它,以阻止更多的人浪费时间(阅读不明确的手册页,提问,回答这些问题的人等)。 >
我总是发现 autocrlf
config属性有问题。
(如我的回答)
- >它不仅使一些合并棘手
- 它可能会有所不同取决于在一个环境中使用的shell
- 它也存在问题 git status
- 和 svn import 。
注意: msysgit issue 538 将其设置为true(这是msysgit安装程序设置的默认值),但我不确信。
我更喜欢以下三种解决方案之一:
- line style
- 使得这个配置通过不同的Git仓库传播
1。使用新的配置设置 core.eol
(1.7.2 +)
设置文本属性设置的文件在工作目录中使用的行结束类型。
其他选项包括'lf
','crlf
'和'native
',它使用平台的本地行结束。
默认值是本机。
2。 结帐/检查 .gitattribute
。
请参阅 gitattribute 手册页:
crlf
或 core.autocrlf
是记录 .gitattributes
文件的方式以前是本地配置属性。
3。一个 git属性过滤驱动,它可以:
.gitattributes
)。
In trying to standardise the platform for the developers, one of my needs would be to commit the .git/config
so that everybody have the same CRLF config without forgetting to set it by hand.
How do I set this up?
I'm a bit concerned by all this negativity against autocrlf
. Why not remove this feature if it doesn't work? Either the makers of this feature are misunderstood or they made a failed experiment with it and it should be removed to stop more people from wasting their time (reading the obscure man page, asking questions, people answering those questions etc.).
I have always found the autocrlf
config property problematic.
(as expressed in my answer Git 1.6.4 beta on Windows (msysgit) - Unix or DOS line termination)
- it not only make some merges tricky
- it can vary depending on the shell used within one environment
- it also has issue with git status
- and with svn import.
Note: msysgit issue 538 for setting it to true (which is the default value set by the msysgit installer), but I am not convinced.
I would prefer one of the three following solutions for:
- configuring one end-of-line style
- making that configuration propagate through the different Git repos
1. Using the new config setting core.eol
(1.7.2+)
Sets the line ending type to use in the working directory for files that have the text property set.
Alternatives are 'lf
', 'crlf
' and 'native
', which uses the platform's native line ending.
The default value is native.
2. a checkout/checking .gitattribute
.
See gitattributes man page:
crlf
or core.autocrlf
is the way to record in a .gitattributes
file what is was previously a local config attribute.
3. a git attribute filter driver which can:
- enforce any kind of formatting standard you may want to set
- apply those standards to certain files/directories
- be recorded as a config file (
.gitattributes
) able to be pushed anywhere.
这篇关于使用代码分发git配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!