1

Whenever I commit from a different computer than the last commit (same account, different SSH keys though, all using Github for Windows), I get results like the following, where the differences show the entire file as being rewritten.

https://github.com/Yttrium-tYcLief/Scrotter/commit/0c012c51bae0db198a10a5fc73294c2eb04d1ea0

Client-side, it does show correctly before syncing the new commit in GH for Windows, but once the commit is synced, on the client (and every other client) the differences field shows the entire rewrite.

Is there any way to fix this?

yttrium
  • 405
  • 4
  • 8
  • But Github’s computers are running Unix, and there are git settings for automatically changing the [different line endings](http://en.wikipedia.org/wiki/Newline#Representations). – andrewdotn Jan 22 '13 at 18:22
  • So Github messes with your code after you commit? That's not cool. I'll report back and see if this works. – yttrium Jan 22 '13 at 18:40
  • Also, why does this issue not arise when only using one computer interfacing with Github (and using one SSH key)? – yttrium Jan 22 '13 at 18:51
  • If you follow the [directions here](http://stackoverflow.com/a/10855862/14558) to store the line ending configuration in the git repository instead of using the—possibly- different—global default on each individual computer, and then renormalize your repo, the problem *should* go away. I’m not an expert in this; I use Mercurial because it is sane. – andrewdotn Jan 22 '13 at 18:55

1 Answers1

1

None of them should be saving with Unicode endings.

Perhaps you are mixing the concepts character encoding and line endings.

If you compare the two versions of the file, you will notice that they are both UTF-8 encoded, so no issue there. As others have suggested the issue is with the line endings. Some how with that last commit you switched from Unix LF line endings to Windows CRLF line endings.

I have found it easiest to stick with Unix LF line endings, even on a Windows machine. I have my text editor set up to use LF line endings by default. From then on if you try to commit with CRLF line endings for some reason git will show you visually with git diff.

crlf

Zombo
  • 1
  • 62
  • 391
  • 407