Every time a PHP developer runs
git diff on the command line a kitten dies:
@@ snippets are called Hunk Headers - because every part of a diff is called a hunk, duh. Unfortunately, git is too stupid to figure out PHP files should be diffâ€™d according to PHP syntax, so you need to give it a hand by using a rule on git attributes.
Unfortunately(2), git attributes are not that easy to configure user-wide as config options are (no
git global commands), thus here's the tip:
- create the folder if it doesn't exist:
~/.config/git(or whatever is in
- write in
- Save and diff away
This can also be configured per project by adding the same text inside a
It's quite weird why Git doesn't understand out of the box that through the file extension, as there are pre-baked settings to understand several syntaxes (such as TeX, Fortran, HTML, etc). Go figure!