acidzombie24 acidzombie24 - 1 year ago 74
Git Question

Is git good with binary files?

Is git good with binary files?

If I have a lot of uncompressed files being modified, and many compressed files never (or almost never) modified, would git handle it well? For example, if I insert or remove the middle and insert data near the end it will notice it as it does with text?

If git isn't good with binary files, what tool might I consider?

Answer Source

In addition to other answers.

  • You can send a diff to binary file using so called binary diff format. It is not human-readable, and it can only be applied if you have exact preimage in your repository, i.e. without any fuzz.
    An example:

    diff --git a/gitweb/git-favicon.png b/gitweb/git-favicon.png
    index de637c0608090162a6ce6b51d5f9bfe512cf8bcf..aae35a70e70351fe6dcb3e905e2e388cf0cb0ac3 100
    GIT binary patch
    delta 85
    delta 135
  • You can use textconv gitattribute to have git diff show human-readable diff for binary files, or parts of binary files. For example for *.jpg files it can be difference in EXIF information, for PDF files it can be difference between their text representation (pdf2text or something like that).


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download