I had an issue with a file that had inconsistent line ending. My file would show a ^M
for every line ending. I ran into this article that shows how to get rid of the ^M
character and set the buffer file encoding to fix the issue.
However, I still see the ^M
character when I stage and commit my file in Magit. Magit show a file that has ^M
as a line ending character even when I fixed this in the file buffer.
Do I need to make Magit aware of my file system encoding. If so, how?
Issue seen in macOS Mojave and Emacs 26.1.
.gitattributes
. Mark the file type as binary in.gitattributes
, do agit checkout MYFILENAME --
, remove theCarriage Return
just by query-replace, commit the file and restore the old version of.gitattributes
. In the net there are recommodations to remove the index of the repository in such cases. That is a insensible sledge-hammer method that does not solve the actual problem (from my point of view). Don't follow that advice.