disclaimer: By Git, I mean \'I\' messed up.
Earlier, I wanted git-gui
to show me the diff
for which it thinks are binary files.
I had a similar problem recently. We have a project-wide .gitattributes
file at the root level, which includes the lines:-
* text=auto
*.sql text
One of our team was writing SQL code using SQL Management Studio which, unknown to him, was saving the files as UTF-16. He was able to check-in the code to Git without problem, but on check-out the code was translated to the Chinese characters as described by this post.
A hexdump of the files in question confirmed the issue was indeed the translation of 0x000A to 0x000A0D.
For us the solution was to convert the files to ASCII using the following:-
Create a temporary .gitattributes
file in the local directory to force git to check-out the file without performing line-ending conversion. e.g. include the line *.sql binary
Check-out the file(s) from Git. You should see that the files have not been translated and have no Chinese characters.
iconv
, which is installed as part of Git For Windows. I think UTF-8 would also be an option if the file contains non-ASCII characters - but this was not necessary for our purposes..gitattributes
file