Trying to fix line-endings with git filter-branch, but having no luck

后端 未结 8 887
被撕碎了的回忆
被撕碎了的回忆 2020-11-22 09:02

I have been bitten by the Windows/Linux line-ending issue with git. It seems, via GitHub, MSysGit, and other sources, that the best solution is to have your local repos set

8条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-22 09:40

    Here's how I fixed all line endings in the entire history using git filter-branch. The ^M character needs to be entered using CTRL-V + CTRL-M. I used dos2unix to convert the files since this automatically skips binary files.

    $ git filter-branch --tree-filter 'grep -IUrl "^M" | xargs -I {} dos2unix "{}"'
    

提交回复
热议问题