Today I learned how to show binary files, more specifically images, using
git diff or
git show CLI. For that I am using iTerm2 imgcat.
In order to get there I had to configure git to allow a custom diff command to specific file types.
So I used git attributes to do that:
echo "*.gif diff=image" >> ~/.gitattributes echo "*.jpg diff=image" >> ~/.gitattributes echo "*.png diff=image" >> ~/.gitattributes git config --global core.attributesfile '~/.gitattributes'
git config --global diff.image.textconv 'imgcat'
Check this out:
imgcatdoes not work with new versions of tmux
git pagers like
morewon’t work either, so you can run
git --no-pager diffor you can pipe with cat like:
git diff | cat
Check also Open images in vimTweet