wtorek, 5 kwietnia 2016

git - stucked with modified files due to eol differences

Once you've got * text=auto set in your .gitattribute file all text files stored in repository will be changed into EOL sequence adequate to the host system. But any time checkouting on another system - all eols will be replaced with its specific. Quite nifty, isn't it?

But if for some reason your text file you've got in staging area contains for instance CRLF and you are working on linux machine - git status reporting it as modified. But you cannot reset this as there are no diff in terms of text=auto. Moreover git stash also seems to work badly, as again nothing to stash found. If you faced such a problem here is the solution

  1. Edit the .gitattribute file by commenting out the * text=auto line (with # sign)
  2. Type git status on the command line
  3. Revert .gitattribute file