【发布时间】:2015-11-29 03:44:26
【问题描述】:
我在一个纯 Windows 的工作环境中工作,开发人员使用各种工具来编辑他们的文件。我们使用 .git 和 atlassian 堆栈来版本我们的代码。我几乎都喜欢。
我最近刚刚完成了一场漫长而艰苦的斗争,以了解 git 如何以及为什么解释行尾以及 core.autocrlf 的作用。我们决定使用core.autocrlf true,一切都差不多了。
我很想知道如何改变git status 的这种行为:
- 我有一个以
CRLF行结尾的文件。 -
我把行尾改成
LF$ git status On branch somebranch Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: Src/the_file_i_changed_to_LF.js -
然后……
$ git commit -a warning: LF will be replaced by CRLF in Src/the_file_i_changed_to_LF.js. The file will have its original line endings in your working directory. On branch somebranch nothing to commit, working directory clean
到这个:
- 我有一个以
CRLF行结尾的文件。 -
我把行尾改成
LF$ git status On branch somebranch nothing to commit, working directory clean - 这是有道理的,因为无论如何都不会提交任何内容。
这可能吗?
我相信可能的重复不符合我正在寻找的答案。我想强调一下,我确实(认为我)知道我的设置 core.autocrlf true 做了什么,并希望保持这种状态。我感兴趣的是要么没有检测到git status 中无论如何都不会提交的更改,要么了解为什么这是不可能的。
【问题讨论】:
标签: windows git end-of-line core.autocrlf