Git Git Diff Diff UTF-16 encoded text and binary plist files


You can diff UTF-16 encoded files (localization strings file os iOS and macOS are examples) by specifying how git should diff these files.

Add the following to your ~/.gitconfig file.

[diff "utf16"]
textconv = "iconv -f utf-16 -t utf-8"

iconv is a program to convert different encodings.

Then edit or create a .gitattributes file in the root of the repository where you want to use it. Or just edit ~/.gitattributes.

*.strings diff=utf16

This will convert all files ending in .strings before git diffs.

You can do similar things for other files, that can be converted to text.

For binary plist files you edit .gitconfig

[diff "plist"]
textconv = plutil -convert xml1 -o -

and .gitattributes

*.plist diff=plist