git svn windows linux whitespace problems

前端 未结 1 533
傲寒
傲寒 2021-02-10 02:42

I use git (with git-svn) on linux and a colleague uses svn on windows.

So many times, git reports whitespace issues. In fact it fails to commit a linear history because

1条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-10 03:31

    Fixing whitespace errors

    Add this to .gitconfig

    [core]
      whitespace=nowarn
    

    git rebase should now work. (You can optionally add some of fix,-indent-with-non-tab,trailing-space to that to have git fix all whitespaces at every commit. Whether that is a good idea depends on your project rules and team. )

    Fixing eol errors

    [core]
      autocrlf = true
    

    in your .gitconfig. This will force every text file to have windows line endings. svn by default ignores line endings and if your text editors on windows are sane you can leave it that way. Otherwise, add this file to your svn config (optionally changing native to CRLF) ensuring consistent CRLF line endings through out.

    Set autocrlf = input and change native to LF for consistently linux line endings throughout.

    0 讨论(0)
提交回复
热议问题