I am diffing a file between forked and upstream BitBucket repos:
$ git diff origin/branchA..upstream/branchB -- some/file/path.xyz
It seems to return the same difference for almost every file:
-<U+FEFF>@using Sitecore.Mvc
+@using Sitecore.Mvc^M
What is the exact meaning of ^M
that only shows up after the first line? I see this issue when I compare other files as well. I am on a Windows Server 2008 R2 machine. core.autocrlf
is set to true
. The .gitattributes is set to text eol=lf
. My git version is 2.5.1.windows.1.
^M
represents carriage return. This diff means something removed a Unicode BOM from the beginning of the line and added a CR at the end.
The ^
symbol stands for Control, so ^M
means Ctrl+M.
To get from that to the actual ASCII character code, you take the base character and flip bit 6 (i.e. XOR with 64). For letters, that just means subtract 64. So e.g. ^A
is character code 1 (because A
is 65). ^M
is 77 - 64 = 13 (because M
is 77), which corresponds to carriage return in ASCII.