I am diffing a file between forked and upstream Bitbucket repositories:
$ 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.
The 'U' means the files are 'untracked', and the 'M' means the files have been 'modified'. You can use the commands: git add -A - To add all the files to the staging area. git commit -m 'message' - To create a 'snapshot' of the files on the staging area.
That's the output of git status ; git is showing you that after checking out master there are still uncommited changes to your working copy (one modified file and one deleted file). Check man git-status : M = modified A = added D = deleted R = renamed C = copied U = updated but unmerged.
Comparing changes with git diff Diffing is a function that takes two input data sets and outputs the changes between them. git diff is a multi-use Git command that when executed runs a diff function on Git data sources. These data sources can be commits, branches, files and more.
When viewing a combined diff, if the two files you're comparing have a line that's different from what they were merged into, you will see the ++ to represent: one line that was added does not appear in either file1 or file2.
^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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With