Timeline for Make 'git diff' ignore ^M
Current License: CC BY-SA 3.0
21 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 17, 2021 at 20:45 | comment | added | Cireo |
If you have files that match your git ignore you need to use git add -f in xargs
|
|
Apr 20, 2021 at 16:12 | comment | added | MarcH | Version control is not the place to solve this problem. Changing files on the fly adds even more complexity and even stranger corner cases. git even had to add a core.safecrlf and SAMBA never implemented anything like it. Use the newer cr-at-eol and don't go anywhere autocrlf. | |
Feb 27, 2018 at 10:56 | comment | added | sashoalm | This doesn't work for files with mixed line endings though. | |
Mar 3, 2017 at 17:51 | comment | added | Francis Rodrigues | I was working on Windows and now I use Debian Jessie. For me, what the @nes1983 mentioned helped me. | |
Jul 27, 2016 at 16:47 | comment | added | demisx |
Once the git config setting has been updated, you can also refresh your local copy with rm .git/index && git reset command.
|
|
Dec 17, 2015 at 15:39 | history | edited | random | CC BY-SA 3.0 |
allow for cooling (github with cap h; jump the redirect)
|
Oct 25, 2015 at 23:28 | comment | added | jmmut |
@trusktr, it happened the same to me. In linux, with accidental CRLF, use git config --global core.autocrlf input , do the steps in this answer(rm, add, commit), and you will get warning: CRLF will be replaced by LF. The file will have its original line endings in your working directory. . Remove the files (because they have the original, wrong CRLF) and checkout them again from the last "Fix CRLF" commit.
|
|
Feb 23, 2014 at 1:00 | comment | added | trusktr |
I'm trying this, but I keep getting warning: LF will be replaced by CRLF instead of warning: CRLF will be replaced by LF , and I'm in Linux. Any idea why? I want all to end with LF, not CRLF!
|
|
S Dec 26, 2011 at 18:03 | history | suggested | Henridv | CC BY-SA 3.0 |
git-config man page moved
|
Dec 26, 2011 at 18:01 | review | Suggested edits | |||
S Dec 26, 2011 at 18:03 | |||||
Dec 11, 2009 at 20:11 | vote | accept | neoneye | ||
Dec 11, 2009 at 19:50 | comment | added | nes1983 | the git config core.whitespace cr-at-eol thing would work. and of course you can write your own commit-hook that transforms cr to lf. | |
Dec 11, 2009 at 19:50 | comment | added | nes1983 | If I may quote my original, unmodified answer: "Of course, this is said to convert crlf to lf, while you want to convert cr to lf. I hope this still works …" | |
Dec 11, 2009 at 19:35 | comment | added | neoneye | @jamessan yeah I just realized that too.. some of the files uses only CR and others LF. There are no CRLF involved. So only the CR files are causing trouble. | |
Dec 11, 2009 at 19:02 | comment | added | jamessan |
You're not working with CRLF files here, at least not in the example you posted. That's an old-style mac file (just uses \r for EOL). That's why the diff is being shown on one line. A file using dos EOL would show each line distinctly with a trailing ^M, which you could tell get to handle via git config core.whitespace cr-at-eol .
|
|
Dec 11, 2009 at 18:53 | comment | added | neoneye | yeah, that is unfortunate. I actually have quite a few repositories and I have never needed to diff CRLF files before. I wish I had known about this option a long time ago. Thank you for enlighten me. | |
Dec 11, 2009 at 18:23 | comment | added | nes1983 | Well … you can write a script and change all the past commits :) It's not pretty, but you can re-write the history of your project. (At the risk of ruining your repo, that is) | |
Dec 11, 2009 at 18:14 | comment | added | neoneye | The problem is that I already have some files in the repository that have CRLF endings and others that doesn't. I suspect that Adobe Flash adds CRLF even though I'm using the Mac version. I need to compare against older revisions of these files. Converting line endings starting from now on does not solve the problem with older revisions :-/ | |
Dec 11, 2009 at 18:04 | comment | added | nes1983 | No, of course not, once the setting is there, it will silently convert upon commit. If everything works the way I think it does, that is … | |
Dec 11, 2009 at 17:46 | comment | added | neoneye | ouch.. will I have to do this for every revision of that file? | |
Dec 11, 2009 at 17:43 | history | answered | nes1983 | CC BY-SA 2.5 |