@@ -574,6 +574,39 @@ and now produces better output), you can remove the cache
574574manually with `git update-ref -d refs/notes/textconv/jpg` (where
575575"jpg" is the name of the diff driver, as in the example above).
576576
577+ Marking files as binary
578+ ^^^^^^^^^^^^^^^^^^^^^^^
579+
580+ Git usually guesses correctly whether a blob contains text or binary
581+ data by examining the beginning of the contents. However, sometimes you
582+ may want to override its decision, either because a blob contains binary
583+ data later in the file, or because the content, while technically
584+ composed of text characters, is opaque to a human reader. For example,
585+ many postscript files contain only ascii characters, but produce noisy
586+ and meaningless diffs.
587+
588+ The simplest way to mark a file as binary is to unset the diff
589+ attribute in the `.gitattributes` file:
590+
591+ ------------------------
592+ *.ps -diff
593+ ------------------------
594+
595+ This will cause git to generate `Binary files differ` (or a binary
596+ patch, if binary patches are enabled) instead of a regular diff.
597+
598+ However, one may also want to specify other diff driver attributes. For
599+ example, you might want to use `textconv` to convert postscript files to
600+ an ascii representation for human viewing, but otherwise treat them as
601+ binary files. You cannot specify both `-diff` and `diff=ps` attributes.
602+ The solution is to use the `diff.*.binary` config option:
603+
604+ ------------------------
605+ [diff "ps"]
606+ textconv = ps2ascii
607+ binary = true
608+ ------------------------
609+
577610Performing a three-way merge
578611~~~~~~~~~~~~~~~~~~~~~~~~~~~~
579612
0 commit comments