Context

Branching is a mechanism in a version control system that allows you to work in a separate environment from the main workstream. For more information, visit the Repositories, Branches, and Workspaces page.

In this tutorial, you will learn how to create branches, work on them, and merge and delete them.

We will be using the Diversion Desktop App, but the workflow is the same regardless of wheter you are using the CLI or the web UI.

I assume you have already created a repository and invited your collaborators; if you still need to, follow the quickstart guide.

Steps

  1. Select your workspace at the top, and click New Branch in the options.
  1. Give a descriptive name to your branch and confirm its creation.

The dialog window will give you details about the branch you’re branching out from and the commit that will be the base of your newly created branch. In this case, we are branching from main, the latest commit is dv.commit.2.

  1. Your branch is ready. The next step is to switch the current branch in the workspace to the one you just created.

In the same workspace menu, click the hamburger icon next to the branch you just created and then click Switch to branch.

Confirm your selection and your workspace will now be linked to the new branch.

All the commits you perform now, will be part of the new branch, and people working on the same branch will get the changes as you commit them.

  1. It is time to merge our changes from our gameplay-test branch into the main branch (it could be the other way around too).

Back to the workspace menu, select a branch not checked out, and you will see two options:

  • Merge "main" -> "gameplay-test"
  • Merge "gameplay-test" -> "main"

In our case, we want to merge the changes from our gameplay-test branch into main.

There won’t be any conflicts for this tutorial, but in a real scenario, you might get asked to solve the conflicts before you can merge.

  1. Lastly, depending on your branching strategy, you can delete the branch you created or merge from a different branch into yours to get the latest changes other team members might have added.