Better binary diffs in Git
Git can handle custom binary diffs as text and therefore display meaningful diff messages if properly configured.
Just add the following to your .gitconfig:
[diff "png"]
binary = true
textconv = hexdump -v -C
[diff "jpg"]
binary = true
textconv = hexdump -v -C
[diff "jpeg"]
binary = true
textconv = hexdump -v -C
There <b>has to</b> be a diff+textconv definition for each extension you want to handle.
For more complicated diffs you might want to set a third-party tool like ImageMagick for images or pdfinfo for pdf files:
[diff "pdf"]
binary = true
textconv = pdfinfo
The binary
boolean is useful when <i>"... you want to use textconv to convert files to an ASCII representation for human viewing, but otherwise treat them as binary files."</i>
For a depeer understanding of this part of git customization, check this link on the so called <b> gitattributes</b>.
Written by Andrea Richiardi
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Git
Authors
khasinski
591.1K
dmichaelavila
500.4K
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#