1

Problem : Here is the real Code Difference & in my commit in github is showing @@ -1,202 +1,251 @@ as this file has been replaced completely. I want to see the difference in code like the below image in github.

enter image description here

System Information : I am editing my code in windows 8.1 with sublime text 2 & in windows 7 with phpdesigner 7

Solutions, I tried before commit :

  • Changed the Line formatting settings in my editor to windows/unix/macOSx
  • In my .gitattribute added * text=auto
  • I have also tried dos2unix & unix2dos commands
  • Strangely, If I edit using vi, it works. But, I am not comfortable using that.

My .gitattribute :

# Auto detect text files and perform LF normalization
* text=auto

# Custom for Visual Studio
*.cs     diff=csharp

# Standard to msysgit
*.doc    diff=astextplain
*.DOC    diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot  diff=astextplain
*.DOT  diff=astextplain
*.pdf  diff=astextplain
*.PDF    diff=astextplain
*.rtf    diff=astextplain
*.RTF    diff=astextplain

Thanks.

Arif
  • 565
  • 5
  • 19
  • I will delete my answer since it doesn't fit the problem you've specified in our conversation, perhaps this answer could [help](http://stackoverflow.com/questions/9933325/is-there-a-way-of-having-git-show-lines-added-lines-changed-and-lines-removed) – e.doroskevic Aug 04 '16 at 14:08
  • @e.doroskevic Thanks for looking into my problem. As I don't want other experts to misunderstand, may I request you to edit my question to resolve any fuzzyness? – Arif Aug 04 '16 at 14:11
  • @Arf that's a high praise. I appreciate that although I am far from it. I do not completely understand the problem, I may speculate and say you want something between the lines of what `git diff` does, but also including the line numbers. Perhaps, add a simple output example you'd want to see. This should help others to help you out – e.doroskevic Aug 04 '16 at 14:17
  • @e.doroskevic Thanks for your suggestion. I have added one image as per that. – Arif Aug 04 '16 at 17:37

1 Answers1

0

The problem is SOLVED.

What I did wrong

  • I run unix2dos not in recursive mode.
  • I don't know why, but my .gitattribute file was one of the cause

Solution

  • Run find . -type f -exec unix2dos {} \; This will automatically change all files to crlf/windows format
  • Removed my .gitattributes file

And TADA, all working as it should be

Arif
  • 565
  • 5
  • 19