Git: Removing carriage returns from source-controlled files

后端 未结 4 530
北恋
北恋 2020-12-24 00:22

I\'ve got a Git repository that has some files with DOS format (\\r\\n line endings). I would like to just run the files through dos2unix (which wo

4条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-24 01:17

    For the continuing solution, have a look at the core.autocrlf (and core.safecrlf) config parameters.

    Doing this once to your whole repository will just create one commit that's pretty impossible to merge with (since every line in those files will be modified), but once you get past it, it should be no big deal. (Yes, you could use git filter-branch to make the modification all the way through history, but that's a bit scary.)

提交回复
热议问题