How to make `nbdiff` not show `modified /cells/0/metadata/execution/` entries?

```bash
nbdiff --ignore-details
```
```
nbdiff CENSORED.ipynb (HEAD) CENSORED.ipynb
--- CENSORED.ipynb (HEAD) (no timestamp)
+++ CENSORED.ipynb 2026-02-17 14:06:55.209449
## modified /cells/0/metadata/execution/iopub.execute_input:
- 2026-02-16T22:14:01.088200Z
+ 2026-02-17T13:05:04.777026Z

## modified /cells/0/metadata/execution/iopub.status.busy:
- 2026-02-16T22:14:01.087953Z
+ 2026-02-17T13:05:04.776699Z

## modified /cells/0/metadata/execution/iopub.status.idle:
- 2026-02-16T22:14:01.381294Z
+ 2026-02-17T13:05:05.086834Z

## modified /cells/0/metadata/execution/shell.execute_reply:
- 2026-02-16T22:14:01.380839Z
+ 2026-02-17T13:05:05.085913Z

## modified /cells/0/metadata/execution/shell.execute_reply.started:
- 2026-02-16T22:14:01.088175Z
+ 2026-02-17T13:05:04.776999Z

## modified /cells/1/metadata/execution/iopub.execute_input:
- 2026-02-16T22:14:01.381818Z
+ 2026-02-17T13:05:05.087574Z
...
```
Apr 17, 8:57am

To exclude the /cells/*/metadata/execution/ entries from the output of nbdiff, you need to use the --ignore flag to specify which paths to ignore. The --ignore-details flag only ignores minor details like timestamps in the metadata, but not the entire execution metadata.

Solution

Use the following command:

bash
nbdiff --ignore "/cells/*/metadata/execution/"

Explanation:

  • --ignore allows you to specify glob patterns for paths to ignore.
  • /cells/*/metadata/execution/ matches all execution metadata under any cell.

Example:

bash
nbdiff --ignore "/cells/*/metadata/execution/" CENSORED.ipynb HEAD

This will suppress all output related to execution metadata, focusing only on meaningful changes in code, markdown, or other cell content.

Apr 17, 8:57am

This is a shared conversation and may include unverified content that doesn't reflect Mistral AI's views. Login to resume chatting.