I have a git repository which is hosted in bit bucket. I use source tree to work with git. I have a pull request in which some files appear as modified, but the contents of the file are essentially unchanged. I noticed that when I compared the two branches in bit bucket and source tree. This is what the diff looks like in those tools :
-j1
-j2
-j3
+j1
+j2
+j3
This is very confusing because (1) it makes it appear as though there are many changes, even though there are no real changes, and (2) any changes to a particular line could be missed if you have a huge file (unlike the small one I showed above.)
But, when I compared the two branches in command line (git diff branch1 branch2
), I saw that there is a ^M
character at the end of each line in one branch which is responsible for the difference.
How do I ensure that end of line characters like ^M
, TAB
, SPACE
etc. get removed in git so that we can avoid confusion in pull requests ? Also, how do I find out why these EOL characters got added in the first place ?