3

Is it possible to extend git (via a plug-in) to support other filetypes which aren't based on plain ASCII files? For the sake of an example: Imagine someone write a diff program for photoshop psd files with PSD.rb to represent changes in the underlying binary psd file as text.

I haven't found anything on google, so perhaps some of the more in depth git hackers can answer this.

Jens Kohl
  • 5,899
  • 11
  • 48
  • 77
  • Note: diff for PSD is supported on GitHub now (June 2014): see http://stackoverflow.com/a/24251514/6309. – VonC Jun 16 '14 at 20:20
  • Note bis: diff for PSD is no longer supported on GitHub now (March 2022)... https://github.blog/changelog/2022-03-22-diffing-adobe-photoshop-documents-is-no-longer-supported/ – VonC Mar 22 '22 at 13:22

1 Answers1

2

Sure, it is called git difftool.
you can specify in a .gitattributes file the extensions for that particular difftool to be applied.

See for instance this blog post "Image diffs with git" by Aki Koskinen

git config --global core.attributesfile '~/.gitattributes'

[~]$ cat .gitattributes 
*.gif diff=image
*.jpg diff=image
*.png diff=image

[~]$ git config --global diff.image.command '~/bin/git-imgdiff'

[~]$ cat ~/bin/git-imgdiff
#!/bin/sh
compare $2 $1 png:- | montage -geometry +4+4 $2 - $1 png:- | display -title "$1" -
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250