Skip to main content

Timeline for Make 'git diff' ignore ^M

Current License: CC BY-SA 2.5

14 events
when toggle format what by license comment
Nov 18, 2021 at 12:48 comment added alper Can I use all three flags?
Mar 18, 2016 at 20:52 comment added Warren Dew Worked great for me, but I was just trying to get diffs that included real code changes and not the added carriage returns.
Dec 1, 2015 at 18:09 comment added infoclogged after using git diff --ignore-space-at-eol , all the irritating line endings changes that wre previosly visible with git diff commands were gone. However, git-diff shows only the way the files differ. During commit i.e git status , one still sees the files with Ctrl-M as a changed file. Under unix, one can change the line ending using dos2unix command. find ./ -name . | xargs dos2unix
Feb 4, 2015 at 16:43 comment added Magnus OK I see what's happening. -w --stat and --ignore-all-space --stat yield identical diff results, with an identical file count to a naked --stat. But I realized that all the files coincidentally ALSO happen to have one or two legitimate diffs mixed in amidst the hundreds of meaningless ^M differences, thus they still appear on the list! Makes sense really since presumably the Windows user had an actual change to check in when the commit was made. Thanks Jakub for helping me pinpoint this.
Feb 4, 2015 at 16:25 comment added Jakub Narębski @Magnus: Do you see the difference between git diff -w --stat and git diff --stat? The former should not show any changes if the difference is only in ^M (i.e. CR LF vs LF).
Feb 4, 2015 at 15:55 comment added Magnus When I diff --stat two branches to see which files have changed, files where ^M is the only difference still appear on the list
Feb 4, 2015 at 15:30 comment added Jakub Narębski @Magnus: these flags are about what Git considers a difference. Their use makes it that Git doesn't show whole file as changed if end-of-line convention changed. This is not an output filter - if there is change, it would be shown with ^M. You can try to either configure less, or change Git pager. HTH
Feb 4, 2015 at 15:27 comment added Magnus these flags have no effect for me... still shows ^M as diffs
Feb 12, 2014 at 20:24 comment added Dennis grr.. none of the 3 worked for me. I am using git on Windows 7 on files with \r line separator character
Apr 10, 2013 at 20:50 comment added nneonneo This solved my problem without having to change my autocrlf settings. Thanks!
Dec 11, 2009 at 18:45 comment added nes1983 Just remember git config --global core.autocrlf true, or bug the git folks until they make it default :)
Dec 11, 2009 at 18:25 comment added neoneye I also tried with "-w" but no luck, still treats it as a single line. Next project I must remember to never ever get any CR into the source code.
Dec 11, 2009 at 18:22 comment added nes1983 None of that really affects the character that identifies the newline.
Dec 11, 2009 at 18:19 history answered Jakub Narębski CC BY-SA 2.5