我在一个仅限 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无论如何都不会提交的更改,要么理解为什么这是不可能的。