Merge branches
Merge branches in Unity Version Control workflows.
Read time 1 minuteLast updated 21 days ago
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 Dashboard
You can merge branches in the DevOps section of your Unity Dashboard:- Open your repository and select the Branches tab.
- To merge a branch, right-click the branch and select Merge branch into.
- On the Merge page, you can edit the default values in the Destination branch and Source dropdown menus if you want.
- If there are no merge conflicts, select Merge.
- In the dialog, add a comment.
- 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:- On the Branch explorer tab, right-click the branch that you want to merge.
- Select Merge from this branch to.
- Select the branch that you want to merge the changes into.
- Select OK.
- 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:- In the Branch explorer tab, right-click the branch you want to merge to.
- Select Switch to this workspace.
- Right-click the branch that you want to merge the changes from and select Merge from this branch.
- Select Apply changes.
- In the Pending changes tab, select Check in.
Merge your branch in the CLI
-
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
-
Run the command to preview a list of what’s going to merge.
cm mergecm merge main/task001 -
Run to actually perform the merge.
cm merge –merge
If any of the changes require manual merge conflict resolution, the command line launches your default merge tool.cm merge main/task001 –merge -
Run to check in the merge.
cm ci -mcm ci -m "merged from task001"