Windows 上的 Git 1.6.4 beta (msysgit) - Unix 或 DOS 行终止 [英] Git 1.6.4 beta on Windows (msysgit) - Unix or DOS line termination
问题描述
我正在我的 Win Vista 开发 VPC 上安装 msysgit 1.6.4 beta.安装屏幕要求我使用 Unix 行终止还是 DOS 行终止.通常,我会选择 DOS,但设置文本表明 DOS 终止可能意味着文件无法与所有 Git 命令行工具一起使用.Unix 行终止声明...大多数 [Windows] 应用程序可以处理这个...".
有谁知道我应该选择哪个选项通过 shell 使用 Git 来为我的 VS 2008 工作?
msysgit 安装过程中的那个设置其实就是在这里修复core.autocrlf
config.
core.autocrlf
<块引用>
如果为true,则在从文件系统读取时,使git将文本文件行尾的CRLF
转换为LF
,并在写入文件系统时反向转换.
该变量可以设置为'input
',在这种情况下,转换仅在从文件系统读取时发生,但文件在末尾用 LF
写出线.
目前,考虑文本"的路径(即服从 autocrlf 机制)纯粹是根据内容来决定的.
我会坚持不要尝试自动转换任何东西,副作用太重要了(就潜在的合并冲突而言,尤其是在具有不同环境的分布式开发中)
如果你的工具可以处理 Unix 风格的行终止,你应该将它们设置为生成 Unix 行,然后可以被 Windows(VS2008、Notepad++、...)和 Unix 读取,并且可以被任何 'sh' Git 脚本.
但是当 core.autocrlf
设置为 false 时,转换文本行终止的决定将是自愿明确的,而不是背景不可见的副作用.
请参阅如何在不同操作系统之间使用 git core.autocrlf
进行行结束转换一个>"
I am installing msysgit 1.6.4 beta on my Win Vista development VPC. An install screen is requesting whether I want to use Unix line termination or DOS line termination. Ordinarily, I'd choose DOS, but the setup text indicates that DOS termination may mean files do not work with all of Git's command line tools. The Unix line termination states "...most [Windows] applications can handle this...".
Does anyone know which option I should choose to use Git via the shell for my VS 2008 work?
That settings during the install process of msysgit is actually here to fix the value of the core.autocrlf
config.
core.autocrlf
If true, makes git convert
CRLF
at the end of lines in text files toLF
when reading from the filesystem, and convert in reverse when writing to the filesystem.The variable can be set to '
input
', in which case the conversion happens only while reading from the filesystem but files are written out withLF
at the end of lines.Currently, which paths to consider "text" (i.e. be subjected to the autocrlf mechanism) is decided purely based on the contents.
I would insist on not trying to convert anything automagically, the side-effects are just too important (in term of potential merging conflict, especially on distributed development with different environments)
If your tools can handle Unix-style line termination, you should set them to produce Unix lines, which can then be read by Windows (VS2008, Notepad++, ...) and Unix alike, and can be processed by any 'sh' Git-scripts.
But with core.autocrlf
set to false, the decision to transform a text line termination will be a voluntary explicit one, not a background invisible side-effect one.
See more at "How line ending conversions work with git core.autocrlf
between different operating systems"
| Resulting conversion when | Resulting conversion when | committing files with various | checking out FROM repo - | EOLs INTO repo and | with mixed files in it and | core.autocrlf value: | core.autocrlf value: -------------------------------------------------------------------------------- File | true | input | false | true | input | false -------------------------------------------------------------------------------- Windows-CRLF | CRLF -> LF | CRLF -> LF | as-is | as-is | as-is | as-is Unix -LF | as-is | as-is | as-is | LF -> CRLF | as-is | as-is Mac -CR | as-is | as-is | as-is | as-is | as-is | as-is Mixed-CRLF+LF | as-is | as-is | as-is | as-is | as-is | as-is Mixed-CRLF+LF+CR | as-is | as-is | as-is | as-is | as-is | as-is
这篇关于Windows 上的 Git 1.6.4 beta (msysgit) - Unix 或 DOS 行终止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!