Book Image

Git Version Control Cookbook

By : Aske Olsson, Rasmus Voss
Book Image

Git Version Control Cookbook

By: Aske Olsson, Rasmus Voss

Overview of this book

Table of Contents (19 chapters)
Git Version Control Cookbook
About the Authors
About the Reviewers

Metadata diff of binary files

Binary files can be hard to diff, depending on the type of the file. Often, the only option is to load two instances of the program to show the files and check the differences visually. In this recipe we'll see how we can use EXIF metadata to diff images in the repository.

Getting ready

We'll use the same repository as we did in the last example and either re-clone it or checkout the exif branch:

$ git clone
$ cd attributes_example
$ git checkout exif

How to do it...

In order to use the EXIF data while diffing binary files, we need to set up a filter to tell Git what to do when a file of *.jpg is to be diffed. EXIF data is metadata embedded in images and is often used by digital cameras to record timestamps, the size of an image, and so on.

We'll write the following line to .gitattributes:

*.jpg diff=exif-diff

This only tells Git that JPG files should use the exif-diff filter; we still need to set it up. To extract...