atom/git-diff

css files show all lines changed while up-to-date

Closed this issue · 3 comments

For some reason all css fils in my project show as changed; even if git status shows nothing new/changed.
Changing focus, refreshing the file or restarting Atom do not fix this.

schermafbeelding 2015-01-04 om 20 35 22

What can be done to fix this?

My assumption is that you are on Windows and you're having a line-ending issue. I suspect this is a duplicate of atom/atom#3768 and can be resolved in the same way.

The advice here might help too: https://discuss.atom.io/t/atom-on-windows-incorrectly-showing-files-as-modified-git/12805

You are right on the line-ending part...
I was using Atom on an OSX system, and discarded the line-ending problem at first, but apparently some external (windows created) files got mixed-in, without setting the correct git settings beforehand.

So now using:
git config --global core.autocrlf input on OSX, to set the lineendings to use to LF(default on OSX)
and using a .gitatributes file that contains something in the line of:

# Autodetect text files
* text=auto

# ...Unless the name matches the following
# overriding patterns

# Definitively text files
*.txt text
*.css text
*.php text
*.md text
*.yaml text
*.htaccess text

# Ensure those won't be messed up with
*.jpg binary
*.png binary
*.gif binary
*.pdf binary
*.data binary

after committing the .gitattributes file and all other pending changes (and pushing it upstream, just to be sure) i followed the steps outlined here (choose your platform to see the correct commands for your system)

Thanks for pointing me in the right direction and sorry for stealing your time! ;)

You're very welcome and I'm happy to help!