nbdime compares and merges Jupyter notebooks with structure-aware logic instead of raw line diffs. It offers terminal and web-based commands and hooks into Git and Mercurial.
Overview
Jupyter notebooks store rich content in JSON, so ordinary line-based diff tools produce noisy output. nbdime understands notebook structure to diff and merge cells, outputs, and metadata more intelligently, including choices such as shortening embedded images in terminal views and auto-resolving some generated fields like execution counters.
Command-line entry points include nbdiff for comparisons, nbmerge for three-way merges with automatic conflict handling where possible, nbshow for terminal-friendly viewing, and nbdiff-web and nbmerge-web for rendered browser views. A web mergetool helps resolve merge conflicts visually.
Git integration can be enabled with nbdime config-git --global so git diff and git merge use nbdime drivers and tools. Mercurial integration is also documented. Installing via pip is the documented primary install path.
The toolset is aimed at authors who version-control notebooks alongside code and need merges and reviews that respect notebook semantics rather than treating files as plain text.
Key features
- Structure-aware notebook diffs
- Three-way notebook merge
- Terminal and web diff viewers
- Git merge and diff drivers
- Mercurial integration
- Web-based merge conflict UI
- Rendered image diffs in web view
Use cases
- Git diffs for .ipynb files
- Resolving notebook merge conflicts
- Reviewing notebook changes in a browser
- Team Jupyter workflows with version control