0

When I do normal line breaks using enter key on my Ubuntu 18 (Virtualbox), it always appeared fine in git - it never added ^M (which I learned is a version of a carriage return/line feed used by DOS). It randomly started adding them to my line breaks and I have no idea why and can't find a solution to get rid of them again.

Another helpful bit of info is that all existing edited line breaks do not show the ^M, only newly edited ones.

Editors tried: gedit, Visual Studio Code, Vim (CLI)

This is what git diff shows:

         </div>
     </form>
</div>
</div>^M
<!--^M
 <ul class="nav navbar-top-links navbar-right">
     <li>
         <a href="#">
karns
  • 101
  • 2
  • 1
    does this fix it: https://askubuntu.com/a/385297/15811 ? Use the command line option – Rinzwind Jul 15 '19 at 12:59
  • 2
    Can you narrow down "all editors"? in which specific editors (CLI? GUI?) have you observed this behavior? – steeldriver Jul 15 '19 at 13:17
  • @steeldriver - I've used vim via command line, I used gedit, I used visual studio code. All of them had the same results, so I figured it had to be an Ubuntu system issue. I ruled out a git config issue because I'd figure all of the other line breaks would now be showing up too. – karns Jul 15 '19 at 13:57
  • @Rinzwind I saw that before posting, but that seems to apply to specific editors, doesn't it? I've ruled out that it is a specific editor issue/config setting. – karns Jul 15 '19 at 13:59
  • yes.that would be gedit. Thing is: you do NOT want to look at the editors you open a file with. You want to look at the one that created the file and how the file got transported. When you create a file in windows it will have a ^M. When you ftp/ssh that file the ^M gets nuked (as we do not use ^M on Linux) – Rinzwind Jul 15 '19 at 14:01
  • @Rinzwind I concur. I tested with multiple editors by going to a spot in code without the ^M and added a line break to confirm that each editor all did the same thing, hence my assumption that it's a system thing. – karns Jul 15 '19 at 14:06

0 Answers0