Convert line-endings for whole directory tree (Git)

前端 未结 6 2176
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-04 04:26

Following situation:

I\'m working on a Mac running OS X and recently joined a project whose members so far all use Windows. One of my first tasks was to set up the c

6条回答
  •  孤街浪徒
    2020-12-04 05:31

    find . -not \( -name .svn -prune -o -name .git -prune \) -type f -exec perl -pi -e 's/\r\n|\n|\r/\n/g' {} \;
    

    This is much safer as it avoids corrupting your git repo. Add or replace .git, .svn with .bzr, .hg or whatever source control your using to the not list.

提交回复
热议问题