How to force consistent line endings in Git commits with cross-platform compatibility
问题 I am having issues with merge conflicts due to line endings while working with someone who uses a different OS. I work on Windows and my colleague is on Mac. When he pushes his changes, sometimes files he hasn't worked on show up in the diff as being changed, because the line endings now show ^M on each file. This has lead to merge conflicts. I read in the Git docs the following: Git can handle this by auto-converting CRLF line endings into LF when you add a file to the index, and vice versa