nbstripout: what does `diff=ipynb` do in .gitattributes?

Viewed 525

I'm using nbstripout to remove Jupyter output before committing. nbstripout generated a .gitattribute file that looks like this:

*.ipynb filter=nbstripout

*.ipynb diff=ipynb

This works as expected, whenever I git status, git diff, or git commit, it doesn't include Jupyter outputs. However, when I remove the second line, it does the same thing.

What does *.ipynb diff=ipynb do in this case?

1 Answers

The diff attribute, when set to a string, references a diff driver.

But the first attributes reference a content filter driver using the same command.
Since the content filter driver is involved when doing a git diff (through the smudge command), it does the same operation (meaning it changes the content of the working tree file compared with the index)

Related