Martin
Martin

Reputation: 905

Why is git showing files as deleted and new instead of diff?

Somehow when committing a change, git shows a file as "deleted", and shows the same file as "added", instead of showing a diff. For example :

(-)file.txt

- hello world
- this is amazing
- some more text

(+)file.txt

+ hello world
+ this is amazing

Instead of showing

(+-) file.txt

hello world
this is amazing
- some more text

Do you have any idea what is causing this? I do not know exactly how this commit was submitted, but it looks like it somehow lost track of the deltas.

Upvotes: 2

Views: 59

Answers (1)

ogzd
ogzd

Reputation: 5692

It is happening because of different line endings. You need to tell git to handle that differences:

$ git config --global core.autocrlf input
# Set this setting on OSX or Linux

$ git config --global core.autocrlf true
# Set this setting on Windows

Upvotes: 1

Related Questions