Package: jupyterlab-git-newland
jupyterlab-gitA JupyterLab extension for version control using GitTo see the extension in action, open the example notebook included in the Binderdemo.RequirementsJupyterLab >= 3.0 (older versionavailable for 2.x)Git (version>=2.x)UsageOpen the Git extension from theGittab on the left panelSet up authenticationInstallTo install perform the following steps, withpip:pipinstall--upgradejupyterlabjupyterlab-gitor withconda:condainstall-cconda-forgejupyterlabjupyterlab-gitFor JupyterLab < 3, you will need to run the following command after installing the package:jupyterlabbuildUninstallpipuninstalljupyterlab-gitor withconda:condaremovejupyterlab-gitFor JupyterLab < 3, you will also need to run the following command after removing the Python package:jupyterlabextensionuninstall@jupyterlab/gitSettingsAuthentication to remote repository hostsThis extensions does not handle credentials or authentication details. In order to connect to a remote host, it is recommended to use SSH.If you are seeing errors similar to[E yyyy-mm-dd hh:mm:ss ServerApp] 500 POST /git/<clone|push|pull|status>on the console which is running the JupyterLab server, you probably need to set up a credentials store for your local Git repository. One of the possibility is to use SSH.Here are the steps to follow (skip any that is already accomplished for your project):Create a SSH keyRegister the public part of it to your Git server:GitHubGitLabOptionally, if you have more than one key managed by your ssh agent:Create a config file for the ssh-agentTell your local Git repository toconnect to remote via sshYou should now be able to pull and push committed changes to and from your remote repository using the respective buttons on the top of the extension's panel.UI SettingsOnce installed, extension behavior can be modified via the following settings which can be set in JupyterLab's advanced settings editor:blockWhileCommandExecutes: suspend JupyterLab user interaction until Git commands (e.g.,commit,pull,reset,revert) finish executing. Setting this totruehelps mitigate potential race conditions leading to data loss, conflicts, and a broken Git history. Unless running a slow network, UI suspension should not interfere with standard workflows. Setting this tofalseallows for actions to trigger multiple concurrent Git actions.cancelPullMergeConflict: cancel pulling changes from a remote repository if there exists a merge conflict. If set totrue, when fetching and integrating changes from a remote repository, a conflicting merge is canceled and the working tree left untouched.commitAndPush: Whether to trigger or not a push for each commit; default isfalse.disableBranchWithChanges: disable all branch operations, such as creating a new branch or switching to a different branch, when there are changed/staged files. When set totrue, this setting guards against overwriting and/or losing uncommitted changes.displayStatus: display Git extension status updates in the JupyterLab status bar. Iftrue, the extension displays status updates in the JupyterLab status bar, such as when pulling and pushing changes, switching branches, and polling for changes. Depending on the level of extension activity, some users may find the status updates distracting. In which case, setting this tofalseshould reduce visual noise.doubleClickDiff: double click a file in the Git extension panel to open a diff of the file instead of opening the file for editing.historyCount: number of commits shown in the history log, beginning with the most recent. Displaying a larger number of commits can lead to performance degradation, so use caution when modifying this setting.refreshIfHidden: whether to refresh even if the Git tab is hidden; default tofalse(i.e. refresh is turned off if the Git tab is hidden).refreshInterval: number of milliseconds between polling the file system for changes. In order to ensure that the UI correctly displays the current repository status, the extension must poll the file system for changes. Longer polling times increase the likelihood that the UI does not reflect the current status; however, longer polling times also incur less performance overhead.simpleStaging: enable a simplified concept of staging. When this setting istrue, all files with changes are automatically staged. When we develop in JupyterLab, we often only care about what files have changed (in the broadest sense) and don't need to distinguish between "tracked" and "untracked" files. Accordingly, this setting allows us to simplify the visual presentation of changes, which is especially useful for those less acquainted with Git.Server SettingsPostgit initactions: It is possible to provide a list of commands to be executed in a folder after it is initialized as Git repository.In~/.jupyter/jupyter_notebook_config.py:c.JupyterLabGit.actions={"post_init":["touch dummy_init.dat"]}Or equivalently injupyter_notebook_config.json:{"JupyterLabGit":{"actions":{"post_init":["touch dummy_init.dat"]}}}TroubleshootBefore consulting the following list, be sure thejupyterlab_gitserver extension and the@jupyterlab/gitfrontend extension have the same version by executing the following commands:jupyterserverextensionlist
jupyterlabextensionlistIf they do not match or one is missing, pleasereinstall the package.Issue: the Git panel does not recognize that you are in a Git repository.Possible fixes:Be sure to be in a Git repository in the filebrowser tabCheck the server log. If you see a warning with a 404 code similar to:[W 00:27:41.800 LabApp] 404 GET /git/settings?version=0.20.0Explicitly enable the server extension by running:jupyterserverextensionenable--pyjupyterlab_gitIf you are using JupyterHub or some other technologies requiring an initialization script which includes the jupyterlab-git extension, be sure to install both the frontend and the server extensionbeforelaunching JupyterLab.Issue: the Git panel is not visible.Possible fixes:Check that the JupyterLab extension is installed:jupyterlabextensionlistIf you don't see@jupyterlab/git v... enabled OKin the list, explicitly install the jupyter labextension by running:jupyterlabextensioninstall@jupyterlab/gitIf you see@jupyterlab/gitunderUninstalled core extensions:, your installation may have been corrupted. You can runjupyter lab clean --alland
reinstall all your extensions.ContributingIf you would like to contribute to the project, please read ourcontributor documentation.JupyterLab follows the officialJupyter Code of Conduct.Development installNote: You will need NodeJS to build the extension package.Thejlpmcommand is JupyterLab's pinned version ofyarnthat is installed with JupyterLab. You may useyarnornpmin lieu ofjlpmbelow.# Clone the repo to your local environmentgitclonehttps://github.com/jupyterlab/jupyterlab-git.git# Change directory to the jupyterlab-git directorycdjupyterlab-git# Install package in development modepipinstall-e.[dev]pre-commitinstall# Link your development version of the extension with JupyterLabjupyterlabextensiondevelop.--overwrite# Rebuild extension Typescript source after making changesjlpmrunbuildYou can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension.# Watch the source directory in one terminal, automatically rebuilding when neededjlpmrunwatch# Run JupyterLab in another terminaljupyterlabWith the watch command running, every saved change will immediately be built locally and available in your running JupyterLab. Refresh JupyterLab to load the change in your browser (you may need to wait several seconds for the extension to be rebuilt).By default, thejlpm run buildcommand generates the source maps for this extension to make it easier to debug using the browser dev tools. To also generate source maps for the JupyterLab core extensions, you can run the following command:jupyterlabbuild--minimize=FalseTo execute the testspytestjupyterlab_git
jlpmruntestContributors ✨The Jupyter Git extension is part ofProject Jupyterand is developed by an open community of contributors. To see who has been active recently, please look at the"Contributors"tab. Below we list the people and entities who contributed in different ways to the project (emoji key):Brian E. Granger📆🎨🤔🔍Saul Shanabrook💻📆👀🚇Jaipreet Singh📆👀💻🎨Frédéric Collonval🚧jupytercalpoly🤝Amazon Web Services🤝The D. E. Shaw Group🤝Ji Zhang💻👀Hana Zarea💻👀Noah Stapp💻👀Ashutosh Bondre💻👀Neelam Gehlot💻👀Konstantin Taletskiy💻👀Max Klein💻👀📆🎨🚇Athan💻👀📆🎨Ian Hunt-Isaak💻👀This project follows theall-contributorsspecification. Contributions of any kind are welcomed!To add yourself, or someone else, to this list you can eitheruse the bot(@all-contributors please add <username> for <contributions>) orthe CLI(jlpm all-contributors add <username> <contributions>).If you manually edit the.all-contributorsrcconfig file, runyarn run contributors:generate.