Menu

Showing posts with label Git diff. Show all posts
Showing posts with label Git diff. Show all posts

Git diff is showing complete file content as changed but there is only few line of changes in file.

This is expected behavior of Git diff and there is nothing wrong in this case. See the issue 52036
When we look the plain diff, we can see that, the old content used Windows style line endings (CR LF), whereas the new content is stored with Unix style line endings (LF).
>> old style.scss file content
Line 1 CR LF
Line 2 CR LF 
>> new style.scss file content
Line 1 LF
Line 2 LF 
We may skip those white space changes from compression using GitLab or Git via UI or command line. 
Steps to hide/ignore white space changes from git diff.
  1. Go to your merge request.
  2. Navigate to change between section.
  3. Click on the setting button, from right side of "change between section"
  4. Unchecked the option "Show whitespace changes"
After doing this you the compare section will show only real changes. Below is the screenshot which you refer.
Show-whitespace-changes-git-diff


We can also see the exact diff using ignore space command
git diff --ignore-space-at-eol

References