0

I have some weird problem with formatting, using WebStorm on Windows. In WebStorm preview code is looking just fine but when I open GitHub preview there are some weird signs like ^M and all code is just one-liner. I was trying to investigate this but without any success.

My only solution is to cut file content, paste to Notepad and then create a new file and paste content from Notepad.

I don't know does it matter but a lot of files in this project was copy+pasted from other project which might be initially wrote on Mac. I don't think it matters because it is happening also for newly created files.

It is a problem with only one repository so I excluded some global problem.

enter image description here

LazyOne
  • 158,824
  • 45
  • 388
  • 391
obaram
  • 321
  • 2
  • 4
  • 13
  • Looks like your files use Mac line endings and you are on Windows. The IDE handles such line ending in those files just fine, but it looks like when you do commit your files to Git, it treats them as Windows (expects to see `CRLF` as a line ending and not Mac style). Check https://stackoverflow.com/questions/1822849/what-are-these-ms-that-keep-showing-up-in-my-files-in-emacs or just google for `^m character git` -- there are plenty of answers. – LazyOne Dec 16 '22 at 10:22
  • What I suggest here is to convert the line endings from Mac to Windows and then commit again. E.g. see https://stackoverflow.com/a/21281924/783119 and.or https://stackoverflow.com/a/40472391/783119 (you can apply that action on a whole folder as well). – LazyOne Dec 16 '22 at 10:24
  • ALSO from WebStorm Help: 1) https://www.jetbrains.com/help/webstorm/configuring-line-endings-and-line-separators.html 2) https://www.jetbrains.com/help/webstorm/resolve-conflicts.html#resolve-conflicts-productivity-tips – LazyOne Dec 16 '22 at 10:25

0 Answers0