# Working with Git(hub) and python notebook tips

**URL:** <https://forum.access-hive.org.au/t/working-with-git-hub-and-python-notebook-tips/6386>\
**Category:** Technical\
**Tags:** python, cosima, github, git\
**Created:** [7 May 2026 04:47 UTC](https://forum.access-hive.org.au/t/working-with-git-hub-and-python-notebook-tips/6386 "2026-05-07T04:47:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cbull](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/cbull/32/2203_2.png) [@cbull](https://forum.access-hive.org.au/u/cbull)\
**Post date:** [7 May 2026 04:47 UTC](https://forum.access-hive.org.au/t/working-with-git-hub-and-python-notebook-tips/6386/1 "2026-05-07T04:47:20Z")

</div>

Find yourself using Git/Github and Jupyter notebooks quite a bit? _Frustrated that these tools don’t natively support `git diff`?_ Here’s two very quick tips to make working with these tools a bit better.

### Tip one:

Get Github to show rich diffs of Jupyter Notebook files in pull requests.

> With the feature preview enabled, you can compare cell-level inputs and outputs (including images), as well as notebook and cell metadata, thanks to [nbdime](https://github.com/jupyter/nbdime).

[Details](https://github.blog/changelog/2023-03-01-feature-preview-rich-jupyter-notebook-diffs/).

Steps:

1. In the upper-right corner of any page, click your profile picture, then click **Feature preview**.
2. To view details for a feature, in the left sidebar, click the feature’s name, i.e., `Rich Jupyter Notebook Diffs`.
3. To the right of a feature’s name, click **Enable**.

### Tip two:

Tweak git settings on Gadi to use `nbdime` (also works anywhere but you’ll need to install `nbdime` yourself)

Add to your `.gitconfig` file (or [the docs](https://nbdime.readthedocs.io/en/latest/) suggest it may be simpler to use `nbdime config-git --enable --global` – untested!)

```bash
[diff "jupyternotebook"]
        command = git-nbdiffdriver diff
[merge "jupyternotebook"]
        driver = git-nbmergedriver merge %O %A %B %L %P
        name = jupyter notebook merge driver
[difftool "nbdime"]
        cmd = git-nbdifftool diff \"$LOCAL\" \"$REMOTE\" \"$BASE\"
[mergetool "nbdime"]
        cmd = git-nbmergetool merge \"$BASE\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\"

```

Here’s a use case example:

```bash
[gadi-login-06: access-om3-paper-2]$ module purge;module use /g/data/xp65/public/modules;module load conda/analysis3
Loading conda/analysis3-26.03
  Loading requirement: singularity
[1217][gadi-login-06: access-om3-paper-2]$ git diff
nbdiff /scratch/tm70/cyb561/tmp/git-blob-jpE5DP/00_template_notebook.ipynb notebooks/00_template_notebook.ipynb
--- /scratch/tm70/cyb561/tmp/git-blob-jpE5DP/00_template_notebook.ipynb 2026-05-06 10:43:11
+++ notebooks/00_template_notebook.ipynb 2026-05-06 10:42:18
## modified /cells/1/source:
@@ -4,4 +4,6 @@
 papermill = False

 # Set esm_file to the datastore for the main experiment of interest
-esm_file = "/g/data/ol01/outputs/access-om3-25km/MC_25km_jra_iaf+wombatlite-test3v2-00532b88/datastore.json"

+esm_file = "/g/data/ol01/outputs/access-om3-25km/MC_25km_jra_iaf+wombatlite-test3v2-00532b88/datastore.json"
+
+this is a test diff

```

Note:

- in the above, the `module load conda/analysis3` command makes `nbdime` available.
