How to normalize working tree line endings in Git?

后端 未结 6 1962
甜味超标
甜味超标 2020-11-28 01:17

I have cloned a repository that had inconsistend line endings. I have added a .gitattributes that sets the text attribute for the files I want to normalize. Now

6条回答
  •  北海茫月
    2020-11-28 01:58

    With Git client 2.16 and higher there is now a much simpler way to do this. Just use:

    git add --renormalize .
    

    Note: it's better to do this with a clean workspace. For details, see:

    • 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

提交回复
热议问题