There’s no easy way to version control notebooks from Jupyter UI. Of course you can drop down to command line & learn a bunch of git commands to version control your notebooks. But not everyone using Jupyter is proficient at git. Hence I built GitPlus, a JupyterLab extension that provides the ability to commit notebooks & create GitHub pull requests directly from JupyterLab UI.

How to version control Jupyter Notebooks

When GitPlus extension is installed, it provides a new menu item Git-Plus in JupyterLab UI. From there, you can commit notebook files or create a GitHub pull request as shown in demo videos below.

How does it work?

  • There’s a server component of the extension that uses gitpython & GitHub APIs to push commits and create pull requests.
  • There’s a client component of the extension that provides the UI and calls appropriate endpoint on the server extension.
  • The client component looks at all the open files in JupyterLab and determines which of those files are under a GitHub repository.
  • It lets you select the repository to which you want to push commit or create pull request.
  • It captures the list of files to commit, commit message and pushes the changes as a commit to remote repository.
  • In case of pull requests, it creates a new branch and pushes the changes there. This newly created branch is compared to default branch (typically master) of your repository.
  • In case of forked repositories, pull request is created on the parent repository.

#data-science #git #version-control #mlops #jupyter-notebook

Introducing GitPlus: Version Control extension for Jupyter
2.35 GEEK