0

I got a problem with using git.Sometimes I pull from some branch(generally master) ,I got whole file conflicts(many src files,quite a mess,especially in STS).I guess it may be related to CRLF settings.So,I try to change related settings about CRLF.

Team:

Guy A:
MAC OS,autocrlf=input, STS : workspace new text line delimiter = unix
Guy B,C:
Win7,autocrlf true->false ,safecrlf:true,STS : workspace new text line delimiter = unix

Here is how I use git after finishing coding:

  1. git status
  2. git add .
  3. git commit -m "something"
  4. git pull origin master
  5. (after solving conflicts) git push
  6. use master branch to merge my commit

now it seems the problem has been solved.However,it's kind of weird to make everyone who use windows to change their default settings.With SVN, there is no such problem.

So, what is the best solution in this situation?Could you please share some better strateges and advice about using git?Thanks for any help and apologize for my poor English.

epicGeek
  • 72
  • 2
  • 10
  • [Read here](https://help.github.com/articles/dealing-with-line-endings/) ... you can configure Git to change line endings to Windows upon checkout on a Windows machine, but then restore original line endings when committing. – Tim Biegeleisen Aug 11 '17 at 02:56

1 Answers1

0

If you didn't change these files locally but it showed conflicts when you pull changes from remote, it's mainly caused the line endings for different OS.

You just need to set git config --global core.autocrlf true in your windows git repo.

More details, you can refer Dealing with line endings.

Marina Liu
  • 36,876
  • 5
  • 61
  • 74
  • 1
    Thanks for your answer.However,default setting for autocrlf on windows is true.And in STS,line ending is CRLF and so is VScode.This is the start of the whole file conflicts.After I set autocrlf to false and STS line ending is LF,it seems the problem has been solve.This is why I am so confused.I googled and searching on stackoverflow,I am still confused. – epicGeek Aug 11 '17 at 03:06
  • Usually set `core.autocrlf` to true can solve the problem. For the difference of true/false/input, you can refer https://stackoverflow.com/questions/3206843/how-line-ending-conversions-work-with-git-core-autocrlf-between-different-operat. – Marina Liu Aug 11 '17 at 05:54