Dimitris Poulopoulos
1 min readMar 27, 2020

--

Git versioning was always a sore point with notebooks. But nbdev takes care of that. From the documentation:

Jupyter Notebooks can cause challenges with git conflicts, but life becomes much easier when you use nbdev. As a first step, run nbdev_install_git_hooks in the terminal from your project folder. This will set up git hooks which will remove metadata from your notebooks when you commit, greatly reducing the chance you have a conflict.

But if you do get a conflict later, simply run nbdev_fix_merge filename.ipynb. This will replace any conflicts in cell outputs with your version, and if there are conflicts in input cells, then both cells will be included in the merged file, along with standard conflict markers (e.g. =====). Then you can open the notebook in Jupyter and choose which version to keep.

You can find more in nbdev’s docs both on the tutorial section as well as on the fix merge conflicts section.

--

--

Dimitris Poulopoulos
Dimitris Poulopoulos

Written by Dimitris Poulopoulos

Machine Learning Engineer. I talk about AI, MLOps, and Python programming. More about me: www.dimpo.me

No responses yet