6

I have a MacBook and am running Windows in a Parallels VM. My development is primarily in Visual Studio, but I like to use Git with the Mac shell (just like it better than what is available for Windows).

When I do a git diff to determine what has changed between commits I am getting the proverbial line ending "changes" that make git think much more has changed than actually has.

I know this is an age old problem, and I have done a lot of research with varying suggestions from a lot of people, but I am not able to solve this issue. The most promising information was found in this SO Post but it didn't solve my issue.

Here are some relevant lines from my .gitconfig...

[core]
    autocrlf = false
    safecrlf = false

Also, I have a .gitattributes in the root of my repo that only contains...

* text eol=crlf

What can I do to make Git stop thinking line ending changes are real changes when performing a diff? Again, I am using a Mac shell to look at Windows files, so this might be part of my issue.

Thanks!

Community
  • 1
  • 1
John Livermore
  • 30,235
  • 44
  • 126
  • 216

2 Answers2

2

I alias gdiff to:

git diff -w origin/`git branch | sed --quiet "s/* \(.*\)/\1/p"`

but you can just do:

git diff -w
Gijs
  • 144
  • 1
  • 1
  • 11
Caseman
  • 96
  • 3
1

Use a conversion utility eg Perl, perl -i -pne "s/\n/\r\n/g" filename

or unix2dos and dos2unix.

See also http://en.wikipedia.org/wiki/Newline#Conversion_utilities

For configuration of GIT see another answer: Force LF eol in git repo and working copy

Community
  • 1
  • 1
QuentinUK
  • 2,997
  • 21
  • 20
  • Thanks for the response. I want to keep the CRLF line endings on the Windows files, but when looking at the differences from the Mac side with git, not see a different line ending as a change. I think the conversion utility would actually change the line endings. – John Livermore Feb 26 '13 at 16:10