diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-01-13 11:34:56 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-01-13 11:34:56 -0800 |
commit | 37ee62bc6b60b566e39c8ea9fbf34b23a9a39d2f (patch) | |
tree | e696089b5bdcdcf201fe6bedbee608ad7abb9903 /Documentation/gitattributes.txt | |
parent | 4b297df9b2c0d91a8593bc026dc70553511cd09b (diff) | |
parent | ab4356111afb28568bf1ad2e909b6ecf9f83a5e6 (diff) | |
download | git-37ee62bc6b60b566e39c8ea9fbf34b23a9a39d2f.tar.gz |
Merge branch 'jk/diff-driver-binary-doc'
* jk/diff-driver-binary-doc:
docs: explain diff.*.binary option
Diffstat (limited to 'Documentation/gitattributes.txt')
-rw-r--r-- | Documentation/gitattributes.txt | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 22b85825ab..a282adb31e 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -591,6 +591,39 @@ and now produces better output), you can remove the cache manually with `git update-ref -d refs/notes/textconv/jpg` (where "jpg" is the name of the diff driver, as in the example above). +Marking files as binary +^^^^^^^^^^^^^^^^^^^^^^^ + +Git usually guesses correctly whether a blob contains text or binary +data by examining the beginning of the contents. However, sometimes you +may want to override its decision, either because a blob contains binary +data later in the file, or because the content, while technically +composed of text characters, is opaque to a human reader. For example, +many postscript files contain only ascii characters, but produce noisy +and meaningless diffs. + +The simplest way to mark a file as binary is to unset the diff +attribute in the `.gitattributes` file: + +------------------------ +*.ps -diff +------------------------ + +This will cause git to generate `Binary files differ` (or a binary +patch, if binary patches are enabled) instead of a regular diff. + +However, one may also want to specify other diff driver attributes. For +example, you might want to use `textconv` to convert postscript files to +an ascii representation for human viewing, but otherwise treat them as +binary files. You cannot specify both `-diff` and `diff=ps` attributes. +The solution is to use the `diff.*.binary` config option: + +------------------------ +[diff "ps"] + textconv = ps2ascii + binary = true +------------------------ + Performing a three-way merge ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |