0

Consider the *.ipynb file extension. This is a text file formatted for use as a Jupyter Notebook.

git diff for these files is impossible to decipher. Merging operations are able to make changes that break the notebook format.

Is there a way to write a plugin or extension for Git which provides custom diffing and merging logic based on file extension?

3

1 Answer 1

2

Yes you can, using Git filters

There are also a few tools that do this for Jupyter Notebooks, for example nbdime or nbstripout, both support Git filters.

Sign up to request clarification or add additional context in comments.

4 Comments

Thank you! Git filters looks like the way to go. Where is the interface documented? What are the requirements for my own executable that acts as a diff and merge filter?
So it looks like this method is for diff only. There appears to be no solution for merge. Here the documentation is pointed to but contains no further details regarding output formatting: stackoverflow.com/a/35607744/2580891
This project has built a "merge driver". Wonder if it can be adapted for generic use: nbdime.readthedocs.io/en/latest/vcs.html#merge-driver

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.