Friday, 7 August 2020

Code Commit From Windows Eclipse Shows Whole File Changed in Git

You might face this issue if you are coding in Windows Eclipse. And you check in code from there while most in your team use Linux or Mac. Now you commit few lines in Git from Eclipse & your team mates are seeing you have changed the whole file. This is a classic End Of Line format issue. When you press Enter to go to next line, Windows generally adds Carriage Return character & one Line feed character. But Linux or MacOS will only add a Line Feed character. Because of this new line separator issue, Git will show that whole file has been changed instead of the few lines that you actually changed.




So how do you solve this whitespace issue in Windows Eclipse? You need to change new line text delimiter option & set it to Unix format. Just check the screenshot. At bottom right, you can see that I have set it to Unix. And that will fix the issue. This is a good way to solve the issue without tempering default value of "core.autocrlf" feature in Git.

No comments:

Post a comment

How To Solve XML Parsing Issue "Content is not allowed in prolog" In Java

If you have come to this post, then you are facing xml parsing issue in Java. Caused by: org.xml.sax.SAXParseException; lineNumber: 1; colum...