> For the complete documentation index, see [llms.txt](https://docs.bdb.ai/data-science-lab-5/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bdb.ai/data-science-lab-5/tabs-for-a-dsl-project/workspace/workspace-folders/repo-folder-attributes/notebook-actions/notebook-version-control.md).

# Notebook Version Control

This page explains the step by step process for Notebook migration and Push to VCS functionality.

## Push into Git (Migration)

A Notebook script can be migrated across the space and server using the Push into GIT option.

{% hint style="warning" %}
*<mark style="color:orange;">**Prerequisites:**</mark>* *Before migrating a DS Lab script or model, the configuration for the Data Science Lab Migration must be set using the Version Control option from the Admin module.*
{% endhint %}

{% hint style="success" %}
*Check out the walk-through on how to migrate/ export a Notebook script to the GIT Repository.*
{% endhint %}

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2F1Dp0gwSvBTKpGRV88hx0%2FPush%20to%20VCS.mp4?alt=media&token=fdbdc003-43d8-49ce-a4fb-8adee2e5cc29>" %}
*Exporting/Migrating a Notebook script to the Git Reposit***ory**
{% endembed %}

* Select a ***Notebook*** from the ***Workspace*** tab.
* Click the ***Ellipsis*** icon to get the Notebook list actions.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FaDmwzmINoObfHtRt0tHf%2Fimage.png?alt=media&amp;token=71df5fea-9c2f-414f-a5cb-e3b3c26e59e3" alt=""><figcaption></figcaption></figure>

* Click the ***Push into VCS*** option for the selected Notebook.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FIRvEExQoiX8MRhqOvIm8%2Fimage.png?alt=media&amp;token=7cb0cb10-bd0d-4a61-a3b8-0f7c7fe88cf7" alt=""><figcaption></figcaption></figure>

* The ***Push into Git*** drawer opens.
* Select the ***Git Export (Migration)*** option.
* Provide a ***Commit Message*** in the given space.
* Click the ***Push*** option.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FfUgloCDzfxxWnmW8TH27%2Fimage.png?alt=media&amp;token=1107e614-ea8b-416f-bbe2-9349ece05c30" alt=""><figcaption></figcaption></figure>

* The selected Notebook script version gets migrated to the Git Repository and the user gets notified by a message.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FNnKwrMNTO6TKhIK8h1Q2%2Fimage.png?alt=media&amp;token=8819391c-31b3-40c2-ae21-fcbc987172bc" alt=""><figcaption></figcaption></figure>

### Importing a DSL Script from GIT <a href="#import-a-dsl-script-from-git" id="import-a-dsl-script-from-git"></a>

After exporting a DSL script, you can sign in to another user account on a different space or server and import the DSL script.

* Click the ***Admin*** module from the ***Apps*** menu.      ​
* Select the ***GIT Migration*** option from the admin menu panel.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FuBxpZRvR5X3jv37vvxlQ%2Fimage.png?alt=media&amp;token=a0650b47-7e2e-4096-8151-60b848ac7112" alt=""><figcaption></figcaption></figure>

* Click the ***Import File*** option.     &#x20;

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FptAun0sEhfkbl96H1xEt%2Fimage.png?alt=media&amp;token=3242e3a2-7907-47ee-a658-1d0eabb4652a" alt=""><figcaption></figcaption></figure>

* The **Import Document** page opens, click the ***Import*** option as suggested in the following image.      &#x20;

<figure><img src="https://content.gitbook.com/content/z33KQNYQvBTgQKJBgwTz/blobs/j7SSkyI0kruFMAiNp4ow/image.png" alt=""><figcaption></figcaption></figure>

* The ***Migration- Document Import*** page opens.
* Select ***New VCS*** as Version Control Configuration.
* Select the ***DSLab*** option from the module drop-down menu.
* Select the ***Notebook*** option from the left side panel.
* All the migrated Notebooks are listed. The user can use the Search bar to customize the displayed list of the exported Notebooks.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FJuj0ScRcO9VM2U3UZqZT%2Fimage.png?alt=media&amp;token=e75277ae-60c2-4f0d-9913-fc2848207e70" alt=""><figcaption></figcaption></figure>

* Select a Notebook from the displayed list to open the available versions of that Notebook.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2Fmu5c0Dc11UXIAoHnbu71%2Fimage.png?alt=media&amp;token=b8e60ec8-3558-49d3-a407-647258dc5515" alt=""><figcaption></figcaption></figure>

* Select a ***Version*** that you wish to import.
* Click the ***Migrate*** option.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2Fd3EHxKbqvwbmzrt4XkKL%2Fimage.png?alt=media&amp;token=9267f7b0-8ac2-427e-96e0-9dcdff567b96" alt=""><figcaption></figcaption></figure>

* A notification message appears informing that the file has been migrated.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FnOcr2tMS80HA1bxLKWbg%2Fimage.png?alt=media&amp;token=72c9f078-5aad-4d26-a1d8-2ac0ab228531" alt=""><figcaption></figcaption></figure>

* Open the ***Data Science Lab*** module and navigate to the ***List Project*** Page.
* The imported ***Notebook*** gets listed with the concerned ***DSL*** Project.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2Fp0uIQeCgoVHjT3QTEE4R%2Fimage.png?alt=media&amp;token=8afbd49f-dafd-431d-bfc3-ac44403d0d56" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
*<mark style="color:green;">Please Note:</mark>*&#x20;

* *The user can migrate only the exported scripts (the exported scripts to the Data Pipeline).*
* While migrating a DSL Notebook/Script using the Export to Git functionality, the concerned Project under which the Notebook is created also gets migrated.&#x20;
* While migrating a DSL Notebook the utility files which are part of the same Project will also get migrated.
  {% endhint %}

## Version Control

{% hint style="info" %}
*Check out the illustration to understand the Version Controlling steps for a Notebook file.*
{% endhint %}

* Select a Notebook file from the Workspace tab.
* Open the Notebook file.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FWHukmjvZCrxyXcUWHxOW%2Fimage.png?alt=media&amp;token=a981650e-95d1-48ad-bfad-b7c3fabbd287" alt=""><figcaption></figcaption></figure>

* Modify the Notebook script.
* Click the ***Save*** icon.&#x20;

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FTLjjyNjbWPVhxuc3yzw1%2Fimage.png?alt=media&amp;token=1ec9388c-b20e-4f73-a5d3-5d578952864a" alt=""><figcaption></figcaption></figure>

* A message appears to notify the user that the workflow changes are saved.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FS7szOEP87V9iU2mChyKA%2Fimage.png?alt=media&amp;token=95e38346-d20d-4876-8b3d-c7715a9830bd" alt=""><figcaption></figcaption></figure>

* Access the Context menu for the Notebook.
* Click the ***Push into VCS*** option for the selected Notebook.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FchLdFzyoUpG3yBKX0h5N%2Fimage.png?alt=media&amp;token=18686002-a3f8-458f-9e91-40813e6cc50c" alt=""><figcaption></figcaption></figure>

* The ***Push into Version Controlling System*** drawer opens.
* Select the ***Version Control*** option.
* Provide a Commit Message.
* Click the ***Push*** option.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FrYgY0RnQcvG2PJ091U7j%2Fimage.png?alt=media&amp;token=ba2f88b0-105b-47bf-a759-8ae992c8fec8" alt=""><figcaption></figcaption></figure>

* The selected version of the Notebook gets pushed to VCS, and the same is informed by a message.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FFW9lUw8ALXkV7f1xkUJI%2Fimage.png?alt=media&amp;token=582e7ccd-cc07-44c4-8751-8fef7bbae774" alt=""><figcaption></figcaption></figure>

* Open the context menu for the Notebook of which multiple versions are pushed to the VCS.
* Click the ***Pull from VCS*** option from the Context menu.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FwRgWQg9sNIFL8uZOpiEP%2Fimage.png?alt=media&amp;token=56af8eef-cb0b-4919-934b-8f791107c03f" alt=""><figcaption></figcaption></figure>

* The ***Pull from Version Controlling System*** drawer opens.
* Select a version using the checkbox.
* Click the ***Pull*** option.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2F84ooWejKNRH6P07wzUI9%2Fimage.png?alt=media&amp;token=dcc4761e-f0aa-4910-8018-3e876174018f" alt=""><figcaption></figcaption></figure>

* A message appears to notify the user that the Notebook is pulled from the VCS.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2Ftd4Pdj0sj4fprbIxorpX%2Fimage.png?alt=media&amp;token=1c4c2e64-a272-4d35-8cee-04db7e63e3d9" alt=""><figcaption></figcaption></figure>

* Select the same Notebook file from the Repo folder of the Workspace tab, and open it
* A message appears to notify that the selected workflow is started.
* The user can verify the Notebook script will reflect the modifications done by the user for the pulled version of the Notebook.&#x20;

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FVAEdnN4ium1wSkaMVoSd%2Fimage.png?alt=media&amp;token=e8a02790-60c4-4e9c-83ac-6cf7cbf040a5" alt=""><figcaption></figcaption></figure>

### Version control for a file Pulled from Git

The Version Control process for a Notebook file that is pulled from Git is different from the Notebook file that has been created by the user in the Data Science Lab module.&#x20;

Click the ***Information*** option provided in the Context menu for a Notebook. It will mention ***Pulled from git*** if the selected Notebook is pulled from Git.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FllY3rArI4j22XefEYeCC%2Fimage.png?alt=media&amp;token=8f59226c-c0de-46e8-9cea-99e75c80afc2" alt="" width="348"><figcaption><p><em><strong>Pulled from git</strong></em></p></figcaption></figure>

{% hint style="info" %}
*<mark style="color:green;">Please Note:</mark> The Notebook file that has been pulled from Git will overwrite each time when it is pulled. Thus, the Notebook file that is pulled from Git will not allow the end-user to select from multiple versions while pulling it from the VCS, but it pulls the latest version each time the Pull from VCS action is performed.*
{% endhint %}

{% hint style="success" %}
*Check out the illustration to understand the Version control steps for a Notebook file that is pulled from the Git Repo.*
{% endhint %}

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2Fuw2J5xAQiAXWB1RcrYr3%2FVersion%20control%20for%20the%20Notebook%20Pulled%20from%20the%20Git.mp4?alt=media&token=bda2a507-9a99-41ae-be6b-ae5b3d1de76d>" %}
***Version control steps for a Notebook pulled from the Git***
{% endembed %}
