tags:

views:

95

answers:

2

Sometimes for example I change a word in line 100 and delete last 4 lines. When I run "git diff" It shows a log which has a -(minus) and +(plus) before all lines whereas I changed only mentioned lines.
I thought it may be due to changing number of all lines but when I saw the changes again I didn't see any change to line numbers.

so what cause this?

+3  A: 

Which text editor are you using? Perhaps it changed line endings between Unix/DOS. (i.e. LF to CR+LF)

Donald
I'm using Netbeans in windows.if it's the problem how do I solve it?
Hamid.P
I'm not familiar with NetBeans, but I found this link: http://wiki.netbeans.org/FaqEditorEOLs
Donald
A: 

That's just formatting to show what lines have been changed (added/removed/etc). Those +s and -s are not actually in your files.

Frank Schwieterman
Yes.I know this!I want the reason git adds shows them!
Hamid.P
Ahh ok. Yeah its probably a CRLF mismatch. Check your autocrlf settings.
Frank Schwieterman
Thanks.but do you know how do I change autocrlf settings?
Hamid.P
I'm afraid I haven't wrapped my head around the best thing to do with the AutoCRLF setting. Here's some background reading: http://stackoverflow.com/questions/2016673/definitive-recommendation-for-git-autocrlf-settings
Frank Schwieterman
My understanding is that you're better off getting your editor to do the right thing and not having to mess with autocrlf.
bstpierre