I'm using Bitbucket and I don't know if that is important.
Why is ^M
being inserted after every line of my source code after merge conflicts. I'm not using Source Tree, just regular git through terminal.
I'm using Bitbucket and I don't know if that is important.
Why is ^M
being inserted after every line of my source code after merge conflicts. I'm not using Source Tree, just regular git through terminal.
Your text editor is showing this escape character if your file contains a mixture of unix and windows style line endings. This is most probably caused by how your text editor and git are set up.
Personally, I always ensure that I checkout from git using unix line endings (also on Windows) and submitting unix line endings, too. In the .gitattributes files you can e.g. specify:
* text eol=lf
Normally, good text editors respect the line ending they find and don't try to convert a file. But you might check the configuration of your text editor.
There is no automated solution for the file having a mixture of both kinds of line endings (^M). You have to go through the file and remove those characters.