Use h5diff in pre-/post-commit hook in git

Dear Florian and all,

I'm coming back to this old topic with some partial solution using h5dump
instead of h5diff.
This solution relies on the 'textconv' configuration option of Git (cf
Basically, it converts the HDF5 file to text using h5dump before running
the diff.

*Quick setup guide:*

- Have h5dump installed

- Edit your ~/.gitconfig file and add the following lines

[diff "hdf5"]
    textconv = h5dump
    xfuncname= "DATASET \\\".*\\\" \\{"

- Set the diff attribute for HDF5 files in your Git repository by adding
this line in .git/info/attributes

*.h5 diff=hdf5

- Then you can run something like

git diff your_hdf5_file.h5

and it will show you a textual output of what changed in this HDF5 file.

Best regards,



On Thu, Nov 12, 2015 at 3:57 PM, Florian Hoffmann <> wrote:

Dear all,

does anybody have experience with using h5diff for creating a human
readable diff message for git ?
I would like to have some kind of pre-commit hook that starts h5diff to
generate a diff report between a HDF5 in its previous state and the one
to be commited.
Of course this pre-commit hook should only be executed for binary HDF5
files. The generated diff should then go the commit's log.

Any suggestion or help ?

Thank you.

Best regards,


Mit freundlichen Grüßen
Dr.-Ing. Florian Hoffmann
inuTech GmbH Phone : +49-(0)911-323843-22
Fuerther Strasse 212 Fax : +49-(0)911-323843-43
90429 Nuernberg E-Mai l :
Germany Internet :

inuTech GmbH
Sitz / Registered Office: Nuernberg
Handelsregister / Companies' Register: AG Nürnberg HRB Nr. 19026
Geschäftsführer / Managing Director: Frank Vogel


Go to to read the details

Hdf-forum is for HDF software users discussion.

Research associate
FSTC, University of Luxembourg
Campus Kirchberg, Office E-007
Phone: +352 46 66 44 5418