Branching and Merging#

Each project in Data Science & AI Workbench has its own repository that the files for the project are stored in. You can create branches off of your project to develop changes locally, then commit and push them to a remote collaborative project repository, where other users will then be able to pull your changes.

Creating a branch#

New branches are always created off of the currently active branch.

From the projects page:

  1. Open your project and start a session.

  2. Open the branch dropdown menu.

  3. Click Create branch.

  4. Provide a name for your branch.

  5. Click Create.

Tip

The current active branch and its parent branch are always identified in the branch dropdown.

Switching between branches#

You can switch between branches that exist in your project using the branch dropdown menu.

  1. Open the branch dropdown menu.

  2. Select the branch you want to work in.

Caution

Your working branch must be clean to switch between branches. Commit and push your work before switching branches!

Note

You may need to refresh your editor view for it to detect the most recent changes.

Pushing changes to a branch#

  1. Click the Commit and Push icon.

  2. Select the files you want to commit to the remote branch from your local branch.

  3. Enter a commit message for your changes.

  4. If necessary, tag a version for your commit.

  5. Click Commit and Push.

Merging changes to a parent branch#

When the changes on your branch are ready, you can merge them into the parent branch using the branch dropdown menu.

  1. Open the branch dropdown menu.

  2. Click Merge changes into parent branch.

  3. Click Merge.

Pulling changes from a parent or remote branch#

If the parent or remote branch has changes applied to it that the active branch does not, you must pull the changes into your local branch to avoid merge conflicts before you push your commits.

  1. Click the Pull icon.

  2. Select the branch that contains changes you need to pull.

  3. Open the Pull dropdown and select a pull method:

    Keep Theirs and Pull

    Discards your local changes in favor of content on the parent branch. Your changes will be lost.

    Keep Mine and Pull

    Discards changes on the parent branch in favor of your local changes. Changes on the parent branch will be overwritten.

    Keep Both and Pull

    Saves the conflicting files with different file names so you can compare their content and decide how you want to reconcile the differences manually.

Deleting a branch#

There is currently no method for deleting a branch from the UI. This feature will be added in a later release. However, you can still delete branches from your project manually if necessary. To delete a branch from a project:

  1. Open your project and start a session.

  2. Open a terminal in your project session.

  3. Run the following commands:

    # Replace <BRANCH> with the name of the branch you want to delete
    git branch -D <BRANCH>
    git push origin :<BRANCH>
    

Caution

If you attempt to delete a branch that another user currently has active, the branch will not be deleted.