{"thread":{"id":"48490","subject":"git diff: meaning of ^M at line ends ?","startedAt":"2018-05-14T16:07:58Z","lastAt":"2018-05-18T15:04:02Z","messageCount":4,"participants":["Frank Schäfer","Torsten Bögershausen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"347605","messageId":"6c23ed9e-4a14-12e4-20ca-3ac6f80cf9ec@googlemail.com","threadId":"48490","inReplyTo":null,"subject":"git diff: meaning of ^M at line ends ?","fromName":"Frank Schäfer","fromEmail":"fschaefer.oss@googlemail.com","sentAt":"2018-05-14T16:08:42Z","receivedAt":"2018-05-14T16:07:58Z","isPatch":false,"sender":{"key":"fschaefer.oss@googlemail.com","avatar":null},"body":"What does ^M at the end of lines in the output of 'git diff' mean ?\n\nThanks,\nFrank\n\n"},{"id":"347616","messageId":"8d7e4807-9a79-e357-8265-95f22ab716e0@web.de","threadId":"48490","inReplyTo":"6c23ed9e-4a14-12e4-20ca-3ac6f80cf9ec@googlemail.com","subject":"Re: git diff: meaning of ^M at line ends ?","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2018-05-14T18:13:43Z","receivedAt":"2018-05-14T18:13:53Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On 14.05.18 18:08, Frank Schäfer wrote:\n> What does ^M at the end of lines in the output of 'git diff' mean ?\n> \n> Thanks,\n> Frank\n> \n\n^M is the representation of a \"Carriage Return\" or CR.\nUnder Linux/Unix/Mac OS X a line is terminated with a single\n\"line feed\", LF.\n\nWindows typically uses CRLF at the end of the line.\n\"git diff\" uses the LF to detect the end of line,\nleaving the CR alone.\n\nNothing to worry about.\n\nIf you want, you can commit those files with\nCRLF in the working tree, and LF in the repo.\n\nMore information may be found here:\n\nhttps://git-scm.com/docs/gitattributes\n\n(Or ask more questions here, if needed)\n"},{"id":"347704","messageId":"ec5c536a-708a-1fd2-6ee2-98271b90b0fb@googlemail.com","threadId":"48490","inReplyTo":"8d7e4807-9a79-e357-8265-95f22ab716e0@web.de","subject":"Re: git diff: meaning of ^M at line ends ?","fromName":"Frank Schäfer","fromEmail":"fschaefer.oss@googlemail.com","sentAt":"2018-05-15T18:04:45Z","receivedAt":"2018-05-15T18:03:59Z","isPatch":false,"sender":{"key":"fschaefer.oss@googlemail.com","avatar":null},"body":"Am 14.05.2018 um 20:13 schrieb Torsten Bögershausen:\n> ^M is the representation of a \"Carriage Return\" or CR.\n> Under Linux/Unix/Mac OS X a line is terminated with a single\n> \"line feed\", LF.\n>\n> Windows typically uses CRLF at the end of the line.\n> \"git diff\" uses the LF to detect the end of line,\n> leaving the CR alone.\n>\n> Nothing to worry about.\nThanks, I already suspected something like that.\nHas this behavior been changed/added recently ?\nI didn't observe it before, although the project I'm currently looking\ninto has always been using CR+LF...\n\nWhy does the ^M only show up in '+' lines ?\nWhen changing the line end from CR+LF to LF, the diff looks like this:\n\n-blahblah\n+blahblah\n\nBut I would expect it to be\n\n-blahblah^M\n+blahblah\n\n\nRegards,\nFrank\n\n> If you want, you can commit those files with\n> CRLF in the working tree, and LF in the repo.\n>\n> More information may be found here:\n>\n> https://git-scm.com/docs/gitattributes\n>\n> (Or ask more questions here, if needed)\n\n"},{"id":"347986","messageId":"a6b95cc0-0676-930e-9a42-325688d24675@web.de","threadId":"48490","inReplyTo":"ec5c536a-708a-1fd2-6ee2-98271b90b0fb@googlemail.com","subject":"Re: git diff: meaning of ^M at line ends ?","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2018-05-18T15:03:50Z","receivedAt":"2018-05-18T15:04:02Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On 15.05.18 20:04, Frank Schäfer wrote:\n> Am 14.05.2018 um 20:13 schrieb Torsten Bögershausen:\n>> ^M is the representation of a \"Carriage Return\" or CR.\n>> Under Linux/Unix/Mac OS X a line is terminated with a single\n>> \"line feed\", LF.\n>>\n>> Windows typically uses CRLF at the end of the line.\n>> \"git diff\" uses the LF to detect the end of line,\n>> leaving the CR alone.\n>>\n>> Nothing to worry about.\n> Thanks, I already suspected something like that.\n> Has this behavior been changed/added recently ?\n\nThat is a good question.\nThere is, to my knowledge, no intentional change.\n\n> I didn't observe it before, although the project I'm currently looking\n> into has always been using CR+LF...\n\nDo you mean that older versions did behave differently ?\nDo you have a version number for the \"old\" handling ?\n\n> \n> Why does the ^M only show up in '+' lines ?\n> When changing the line end from CR+LF to LF, the diff looks like this:\n\n> \n> -blahblah\n> +blahblah\n> \n> But I would expect it to be\n> \n> -blahblah^M\n> +blahblah\n\nMay be this helps (I haven't tested it) ?\ngit config  core.whitespace cr-at-eol\n\n"}]}