我已经克隆了行尾不一致的存储库。我添加了一个.gitattributes,它设置了我要规范化的文件的text属性。现在,当我提交更改时,我收到消息:

warning: CRLF will be replaced by LF in FILE.
The file will have its original line endings in your working directory.

如何让git为我规范化文件的工作副本?最好我想让git标准化整个工作树。

最佳答案

使用Git客户端2.16和更高版本,现在有一种更简单的方法来执行此操作。只需使用:

git add --renormalize .

注意:最好使用干净的工作区进行此操作。有关详细信息,请参见:
  • https://git-scm.com/docs/gitattributes#_end_of_line_conversion
  • https://help.github.com/en/github/using-git/configuring-git-to-handle-line-endings#refreshing-a-repository-after-changing-line-endings
  • 08-27 18:42
    查看更多