Good work finding the relevant issue report! There was a bug where the IDE would produce inconsistent line endings. The chosen solution was to make them consistent, but fixed according to your OS. Even though I use Windows, I also prefer to use Unix style line endings in all my files. I think the solution proposed by matthijskooijman would be ideal. I think the Arduino developers would be receptive to a patch contributed from the community for this change. Otherwise we can wait and hope they get to it eventually. Unfortunately, I don't think it will be a high priority for them since the current behavior is an improvement over the previous behavior and can't be considered a bug. For now, I just have my Git settings so that all files are committed to my repositories with Unix style line endings. So, even though the sketches on my computer aren't formatted as I prefer, at least I don't subject the rest of the world to Windows style line endings.
You got it. I set core.autocrlf to input in all my own repositories. That means it checks out line endings as-is, but commits Unix style line endings.
My global setting is core.autocrlf false because if I’m contributing to someone else’s repository and the file I’m editing has something other than Unix EOL then I don’t want to change the line endings of the file as an unintended side effect of my unrelated edit. If I did want to change their line endings I would do that in a dedicated commit to keep the changes atomic and the diff easily readable.