Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 ?

like image 829
Christophe Roussy Avatar asked Oct 24 '25 15:10

Christophe Roussy


1 Answers

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.)

like image 165
torek Avatar answered Oct 26 '25 07:10

torek



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!