I'm having an issue where every single new line registers as a change in my pull request. These are existing new lines not lines that I've created while making changes. It's making the pull request difficult to review because instead of showing just a few changes to the code it shows hundreds of meaningless whitespace changes. It's not showing trailing spaces or indentations as changes ONLY new lines. I'm using Atom for my text editor and Git for version control. I'm thinking the issue is in Git, but I'm not certain. I've never had this issue before and have been using these tools for about a year. Any help would be greatly appreciated.
As it turns out the issue was related to the line endings configuration in Git. I believe one of my collaborators is on a Windows machine which may have changed the line ending characters on the file and triggered the issue I was experiencing. I changed the git line ending settings with this command git config --global core.autocrlf input
which tells git to convert the line endings from CRLF(Windows) to LF(Mac/Linux). That resolved my issue. That was a fun 4 hours! See the paragraph below for the source of the fix:
Link: https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration
If you’re on a Linux or Mac system that uses LF line endings, then you don’t want Git to automatically convert them when you check out files; however, if a file with CRLF endings accidentally gets introduced, then you may want Git to fix it. You can tell Git to convert CRLF to LF on commit but not the other way around by setting core.autocrlf to input:
git config --global core.autocrlf input