Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
How to diff your .sketch files in Git

Using sketchtool to diff your .sketch files using text


You need to have SketchTool installed somewhere in your path.


Add this in your ~/.gitconfig file (for some reason, it won't work in a local .gitconfig file):

[diff "sketchtool"]
  textconv = "sketchtool dump"
  cachetextconv = true
  binary = true

and then add this in your local or global .gitattributes file:

*.sketch diff=sketchtool


Now, whenever you modify a .sketch file in your repo, running git diff will produce a nice text diff like this:

screenshot 2015-11-16 09 15 50

This trick only worked for me with a project-local .gitattributes file, not a global one. Not sure why. @bomberstudios thanks for the tip!

adoyle-h commented Aug 4, 2016

@ZevEisenberg You should set core.attributesfile in the global gitconfig file. Like this:

    attributesfile = ~/.gitattributes

You could also run the command git config --global core.attributesfile ~/.gitattributes to set the path for your global gitattributes file.

seehadley commented Sep 13, 2016

Thanks for sharing this. One thing I've run into is many changes that appear to be unrelated to the change I made. In fact, to test this out I just changed the border radius on a single rectangle and can't find the change in the tool. Any suggestions?

Has anyone been able to achieve the same in SourceTree?

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