diff returning entire file for identical files

后端 未结 4 928
清酒与你
清酒与你 2020-12-01 14:04

I\'ve got a website that has a git repo. I cloned the repo so that I could develop in one directory and then push to the repo, and then pull in the live/prod directory (woul

相关标签:
4条回答
  • 2020-12-01 14:13

    That usually means the line endings are different. Most diffin programs allow you to ignore differences in line endings. Does yours allow you to do so?

    0 讨论(0)
  • 2020-12-01 14:17

    Not the solution, will help this to you.

    git diff --no-ext-diff --ignore-space-change -- <path> -> You can view only the code changes in git bash.

    0 讨论(0)
  • 2020-12-01 14:18

    This seems like a whitespace issue, in order to avoid them in the future, you can setup Git to normalize them.

    Windows and UNIX system don't use same line-ending, to prevent conflict from happening based on these, you should setup you git config this way:

    • Windows : git config --global core.autocrlf true
    • Unix : git config --global core.autocrlf input

    Next, to make sure we only commit with ideal whitespace rules, you can set this config option:

    git config --global core.whitespace trailing-space,space-before-tab,indent-with-non-tab
    
    0 讨论(0)
  • 2020-12-01 14:28

    Most likely it's line termination. Try git diff --ignore-space-at-eol. And for plain (not git) diff it's diff -b.

    0 讨论(0)
提交回复
热议问题