Interview Prep/Git & GitHub/Config, Line Endings, Files and Platform Quirks

`git diff` says `Binary files a/strings.rc and b/strings.rc differ` for a text file, and merges of it always conflict.

AdvancedTroubleshootingConfig, Line Endings, Files and Platform Quirks
Answer

Likely causes → The file is UTF-16 (common for Windows resource files, PowerShell output, some SQL Server scripts). The NUL bytes make Git treat it as binary, so no line diffs or text merges.

Diagnose →

file strings.rc                 # "Little-endian UTF-16 Unicode text"
git check-attr -a strings.rc

Fix → Store it as UTF-8 in the repo and convert on checkout:

*.rc text working-tree-encoding=UTF-16LE-BOM eol=crlf
git add --renormalize strings.rc && git commit -m "Store .rc as UTF-8 in repo"

For read-only diffs without changing storage, use a textconv driver: diff=utf16 with git config diff.utf16.textconv 'iconv -f utf-16 -t utf-8'.

Prevent → Prefer UTF-8 everywhere; add working-tree-encoding rules for tools that insist on UTF-16.

All Git & GitHub questions Roadmap: Git & GitHub

More on Config, Line Endings, Files and Platform Quirks