Merge branches

When you work on a branch, after you've finished the task, you can merge the branch back into another branch, such as your main branch.

Merge your branch in the Unity Cloud Dashboard

You can merge branches in the DevOps section of your Unity Cloud Dashboard:

  1. Open your repository and select the Branches tab.
  2. To merge a branch, right-click the branch and select Merge branch into.
  3. On the Merge page, you can edit the default values in the Destination branch and Source dropdown menus if you want.
  4. If there are no merge conflicts, select Merge.
  5. In the dialog, add a comment.
  6. Select Check-in merge.

Merge your branch in the GUI

Merge from this branch to

To merge a branch without switching to the target branch, use the Merge from this branch to option:

  1. On the Branch explorer tab, right-click the branch that you want to merge.
  2. Select Merge from this branch to.
  3. Select the branch that you want to merge the changes into.
  4. Select OK.
  5. Select Check in merge!.

Merge from this branch

You can also configure your current workspace to load the contents of the target branch of the merge, and then you select the source branch to merge from:

  1. In the Branch explorer tab, right-click the branch you want to merge to.
  2. Select Switch to this workspace.
  3. Right-click the branch that you want to merge the changes from and select Merge from this branch.
  4. Select Apply changes.
  5. In the Pending changes tab, select Check in.

Merge your branch in the CLI

  1. Run the switch command to switch to the target branch.

    If you have pending changes in your current workspace, you can’t switch branches.

    cm switch main
  2. Run the cm merge command to preview a list of what’s going to merge.

    cm merge main/task001
  3. Run cm merge –merge to actually perform the merge.

    cm merge main/task001 –merge

    If any of the changes require manual merge conflict resolution, the command line launches your default merge tool.

  4. Run cm ci -m to check in the merge.

    cm ci -m "merged from task001"

Additional resources