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