Christophe Roussy
Christophe Roussy

Reputation: 16999

Which diff formats are supported by Git?

In .gitattributes I see things like:

*.htm           text diff=html
*.html          text diff=html
*.java          text diff=java
...                  diff=astextplain

How are those called, diff formats, diff outputs ?

Where is the list of all supported diff formats ?

Upvotes: 4

Views: 1609

Answers (1)

torek
torek

Reputation: 488213

Git just refers to these as "attributes" in general, and describes them in the gitattributes documentation. The diff= setting is the "diff attribute", and for whatever reason, the list of built-in attributes is in the section titled Defining a custom hunk-header:

First, in .gitattributes, you would assign the diff attribute for paths.

*.tex   diff=tex

(this is where Git labels this the "diff attribute").

There are a few built-in patterns to make this easier, and tex is one of them, so you do not have to write the above in your configuration file (you still need to enable this with the attribute mechanism, via .gitattributes). The following built in patterns are available: ...

(I won't reproduce the whole list here, which is fairly long. Note that different versions of Git have different built-in patterns, so you should look at the documentation for your specific version of Git, which you should be able to view with git help gitattributes.)

Upvotes: 5

Related Questions