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 comment has been minimized.

Copy link

ZevEisenberg commented Mar 2, 2016

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


This comment has been minimized.

Copy link

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.


This comment has been minimized.

Copy link

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?


This comment has been minimized.

Copy link

milsanore commented Mar 10, 2017

Has anyone been able to achieve the same in SourceTree?


This comment has been minimized.

Copy link

AndyDentFree commented Nov 19, 2018

This works for me in Sourcetree 2.7.6. I put the absolute path of sketchtool in my ~/.gitconfig and added a single-line .gitattributes file as per above, directly in the repo. Now in SourceTree, instead of seeing a comparison of the bitmap preview of the doc, I see a text diff of the changes.


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