patterns are available:
- `ada` suitable for source code in the Ada language.
- `bash` suitable for source code in the Bourne-Again SHell language.
Covers a superset of POSIX shell function definitions.
- `bibtex` suitable for files with BibTeX coded references.
- `cpp` suitable for source code in the C and C++ languages.
- `csharp` suitable for source code in the C# language.
- `css` suitable for cascading style sheets.
- `dts` suitable for devicetree (DTS) files.
- `elixir` suitable for source code in the Elixir language.
- `fortran` suitable for source code in the Fortran language.
- `fountain` suitable for Fountain documents.
- `golang` suitable for source code in the Go language.
- `html` suitable for HTML/XHTML documents.
- `java` suitable for source code in the Java language.
- `kotlin` suitable for source code in the Kotlin language.
- `markdown` suitable for Markdown documents.
- `matlab` suitable for source code in the MATLAB and Octave languages.
- `objc` suitable for source code in the Objective-C language.
- `pascal` suitable for source code in the Pascal/Delphi language.
- `perl` suitable for source code in the Perl language.
- `php` suitable for source code in the PHP language.
- `python` suitable for source code in the Python language.
- `ruby` suitable for source code in the Ruby language.
- `rust` suitable for source code in the Rust language.
- `scheme` suitable for source code in the Scheme language.
- `tex` suitable for source code for LaTeX documents.
Customizing word diff
^^^^^^^^^^^^^^^^^^^^^
You can customize the rules that `git diff --word-diff` uses to
split words in a line, by specifying an appropriate regular expression
in the "diff.*.wordRegex" configuration variable. For example, in TeX
a backslash followed by a sequence of letters forms a command, but
several such commands can be run together without intervening
whitespace. To separate them, use a regular expression in your
`$GIT_DIR/config` file (or `$HOME/.gitconfig` file) like this:
------------------------
[diff "tex"]
wordRegex = "\\\\[a-zA-Z]+|[{}]|\\\\.|[^\\{}[:space:]]+"
------------------------
A built-in pattern is provided for all languages listed in the
previous section.
Performing text diffs of binary files
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sometimes it is desirable to see the diff of a text-converted
version of some binary files. For example, a word processor
document can be converted to an ASCII text representation, and
the diff of the text shown. Even though this conversion loses
some information, the resulting diff is useful for human
viewing (but cannot be applied directly).
The `textconv` config option is used to define a program for
performing such a conversion. The program should take a single
argument, the name of a file to convert, and produce the
resulting text on stdout.
For example, to show the diff of the exif information of a
file instead of the binary information (assuming you have the
exif tool installed), add the following section to your
`$GIT_DIR/config` file (or `$HOME/.gitconfig` file):
------------------------
[diff "jpg"]
textconv = exif
------------------------
NOTE: The text conversion is generally a one-way conversion;
in this example, we lose the actual image contents and focus
just on the text data. This means that diffs generated by
textconv are _not_ suitable for applying. For this reason,
only `git diff` and the `git log` family of commands (i.e.,
log, whatchanged, show) will perform text conversion. `git
format-patch` will never generate this output. If you want to
send somebody a text-converted diff of a binary file (e.g.,
because it quickly conveys the changes you have made), you
should generate it separately and send it as a comment _in
addition to_ the usual binary diff that you might send.
Because text conversion can be slow, especially when doing a
large number of them with `git log -p`, Git provides a mechanism
to cache the output and use it in future