Skip to content

Instantly share code, notes, and snippets.

@sprhawk
Created May 24, 2012 03:06
Show Gist options
  • Save sprhawk/2779208 to your computer and use it in GitHub Desktop.
Save sprhawk/2779208 to your computer and use it in GitHub Desktop.
git diff localizable.strings
(from :http://www.entropy.ch/blog/Developer/2010/04/15/Git-diff-for-Localizable-strings-Files.html)
First, add this to the project’s .git/info/attributes file:
+
*.strings diff=localizablestrings
(Unfortunately you do have to add it to every project, there doesn’t seem to be a global attributes configuration file)
Second, add this to your ~/.gitconfig file:
+
[diff "localizablestrings"]
textconv = "iconv -f utf-16 -t utf-8"
@aonez
Copy link

aonez commented Aug 22, 2017

Thanks for this one 👍

@aonez
Copy link

aonez commented Aug 22, 2017

Broke the diff for Localizable.strings... ☹️

@TosinAF
Copy link

TosinAF commented Sep 14, 2017

@anoez add binary = false

@axello
Copy link

axello commented Feb 23, 2018

@TosinAF, add binary = false to what?
To the .gitattributes file, or the [diff "localizablestrings"] part?

@timdiggins
Copy link

FYI @axello @TosinAF I didn't find binary=false necessary.

Also there is a user-global configuration file for git attributes that you can add *.strings diff=localizablestrings to:

~/.config/git/attributes on my OSX.

The exact location for you might be either $XDG_CONFIG_HOME/git/attributes or $HOME/.config/git/attributes (see https://git-scm.com/docs/gitattributes for exact rules)

@shyambhat
Copy link

Thanks for the gist. This works for me locally with git and Sourcetree. But this isn't helping with the diffs in GitHub pull requests. The diffs do not show on the strings files. Anyone has ideas on how to get that to work?

github-diff

@AllDmeat
Copy link

AllDmeat commented Oct 29, 2019

Works like a charm with Tower, thx.

Here's my .gitattributes located in project's root:

*.strings diff=localizablestrings
[diff "localizablestrings"]
	textconv = "iconv -f utf-16 -t utf-8"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment