Solving Git LF will be replaced by CRLF

If you are using Window machine your new line is a character CR LF but for Mac and Linux is LF

This make git status show every file change. All files in repos are in red.

when you try to see the diff

What we want is only CRLF to make the code work on our Window workspace and LF elsewhere.

The fix is by use autocrlf

You won’t see it work unless you delete and clone the repos again or restart the index by

What does it do?

From the git document here.

“Git can handle this by auto-converting CRLF line endings into LF when you add a file to the index, and vice versa when it checks out code onto your file system.”

In short, when code enter your machine git add CR. When you add file by git, git strip off CR .

Web Application | Software | IoT

https://www.codemonday.com

--

--

Co-founder and Coder at work !

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store