> For the complete documentation index, see [llms.txt](https://docs.bdb.ai/data-science-lab-6/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-6/data-science-notebook/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="info" %}
*<mark style="color:green;">**Prerequisites**</mark><mark style="color:green;">:</mark> It is required to set the configuration for the Data Science Lab Migration using the **Version Control** option from the **Admin module** before migrating a DS Lab script or model.*
{% 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%2F28ipFzCz8EMtVtHrBFLx%2Fuploads%2FvFVkYwpwbRRnl4s2fpul%2FMigrating%20a%20DSL%20Notebook%20script.mp4?alt=media&token=a257c3d6-755f-46cf-b060-f02b5734a19d>" %}
***Migrating a DSL Notebook sc*****ript**
{% endembed %}

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

<figure><img src="https://content.gitbook.com/content/28ipFzCz8EMtVtHrBFLx/blobs/GvFjmMtUs6vu1qi932x3/image.png" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://content.gitbook.com/content/28ipFzCz8EMtVtHrBFLx/blobs/fLhDxKL1n1wn6zAbAvSv/image.png" 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://content.gitbook.com/content/28ipFzCz8EMtVtHrBFLx/blobs/Fen8GftmLYj5QUgnbBAj/image.png" 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://content.gitbook.com/content/28ipFzCz8EMtVtHrBFLx/blobs/9mLDsjSZ0KnesLR6yko6/image.png" 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://content.gitbook.com/content/28ipFzCz8EMtVtHrBFLx/blobs/VLjSAhqVZqXUQLs7Ucmn/image.png" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://content.gitbook.com/content/28ipFzCz8EMtVtHrBFLx/blobs/N3I0SfSzjd2HMfaR6K5I/image.png" 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/28ipFzCz8EMtVtHrBFLx/blobs/SphtZA7LiWDEKHIHEVZz/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://content.gitbook.com/content/28ipFzCz8EMtVtHrBFLx/blobs/F3ajoBlk5VlFvvJCpfE7/image.png" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://content.gitbook.com/content/28ipFzCz8EMtVtHrBFLx/blobs/dDP5pYBXeLYjv3QcJZzA/image.png" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://content.gitbook.com/content/28ipFzCz8EMtVtHrBFLx/blobs/Xmu0J7poyUQEPA3dvnqu/image.png" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://content.gitbook.com/content/28ipFzCz8EMtVtHrBFLx/blobs/sVsjdYoQqzAaFTOIIXON/image.png" 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://content.gitbook.com/content/28ipFzCz8EMtVtHrBFLx/blobs/lnqkPGVFRzcSwR3k8jkY/image.png" 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="success" %}
*Check out the illustrations on the Notebook Version Control functionality.*
{% endhint %}

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28ipFzCz8EMtVtHrBFLx%2Fuploads%2FjcqUECLTnp96QLK57U71%2FPushing%20multiple%20Notebook%20versions%20to%20VCS.mp4?alt=media&token=7b5dffab-466e-4070-8861-5e1ad6df5928>" %}
***Pushing Multiple Versions to the VCS***
{% endembed %}

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28ipFzCz8EMtVtHrBFLx%2Fuploads%2FvXCTCl8eD6C5rJfiXm3h%2FPulling%20a%20version%20of%20Noebook%20from%20VCS.mp4?alt=media&token=98edb965-3157-4ce9-a8b1-a14086c0a497>" %}
***Pulling a Version from the VCS***
{% endembed %}

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

<figure><img src="https://content.gitbook.com/content/28ipFzCz8EMtVtHrBFLx/blobs/ww1Wap8mZWHTDxAaAlHK/image.png" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://content.gitbook.com/content/28ipFzCz8EMtVtHrBFLx/blobs/tOwPMH9h9176T4r6YhxC/image.png" alt=""><figcaption></figcaption></figure>

* A message notifies the user that the workflow changes are saved.

<figure><img src="https://content.gitbook.com/content/28ipFzCz8EMtVtHrBFLx/blobs/EWlfdxRCFR5y2Teml7R3/image.png" 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://content.gitbook.com/content/28ipFzCz8EMtVtHrBFLx/blobs/itNFOA7hxLi09dE0ytgJ/image.png" 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://content.gitbook.com/content/28ipFzCz8EMtVtHrBFLx/blobs/FqaOuD7YWaM0VxdTg8r6/image.png" 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://content.gitbook.com/content/28ipFzCz8EMtVtHrBFLx/blobs/qHvLmTcpfFfzaZjPux1S/image.png" 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://content.gitbook.com/content/28ipFzCz8EMtVtHrBFLx/blobs/VDTvKciGR4F3GcT49aW6/image.png" 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://content.gitbook.com/content/28ipFzCz8EMtVtHrBFLx/blobs/Cuogd3yEE2VrrwYAfIC1/image.png" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://content.gitbook.com/content/28ipFzCz8EMtVtHrBFLx/blobs/PeCxWvdGuS56nLmN0iJw/image.png" 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://content.gitbook.com/content/28ipFzCz8EMtVtHrBFLx/blobs/FtAE5cPObGpqbVT6RG2s/image.png" alt=""><figcaption></figcaption></figure>

### Version control for a file Pulled from Git

The Version Control feature for a Notebook file pulled from Git differs from the Notebook file created/ owned by the user.&#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://content.gitbook.com/content/28ipFzCz8EMtVtHrBFLx/blobs/vaKlAZoHU0kXXXqm0siQ/image.png" 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 from Git gets overwritten with each pull, consistently fetching the latest version and does not allow version selection.*
{% endhint %}

{% hint style="success" %}
*Check out the illustration to understand the Version control steps for a Notebook file 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 %}
