Skip to main content
100%

Git to diff zip (or any compressed) files. See this (https://tante.cc/2010/06/23/managing-zip-based-file-formats-in-git/) article.

✓ Published0🌍 Public
HHugoberry
Last edited Jul 18, 2019
Created on Feb 11, 2020

This example shows how Git can produce human-readable diffs for compressed or archive files by treating them as text streams. It demonstrates a `.gitattributes` rule that assigns the `diff=archive` attribute to a wide range of formats, from `.7z` and `.zip` to `.iso` and `.vmdk`. The accompanying `.gitconfig` section defines a `textconv` filter that pipes each file through the command `7z -so e`, extracting its contents to standard output, and marks the diff as `binary` to prevent Git from attempting its own binary detection. This approach leverages Git’s existing `textconv` mechanism, not a custom API, to let users review archive contents directly in `git diff`.

AI-generated description

Similar vizzes