Merging saves a branch’s versions of tests and flows to master. If someone updated one of those tests or flows on master after you edited it on the branch, the merge has a conflict, and you need to decide how to reconcile both sets of changes without losing anything in the process.
This article explains how to:
- Merge a branch and handle conflicts
- Merge from the mabl CLI or an AI client
- Revert a merge
- Delete a branch
Before you merge
Open the branch details view to check for conflicts. The branch details view provides a summary of tests and flows on the branch. A red exclamation icon in the Conflicts column means someone has updated that test or flow on master since the last version on the branch was saved.
The branch details view
To leave feedback on changes before merging, see commenting on branched versions. Comment threads in the compare view help you and your team align on changes before merging.
Merge a branch
On the branch details page, click Merge branch to start the process.
- If there are no conflicts, click Merge now.
- If there are conflicts, the merge dialog lists each conflicting test and flow. Choose one of three options:
| Option | Details |
|---|---|
| Merge with assistant | The mabl assistant adds master's newer changes to the branch version, runs the tests, and merges once they pass. |
| Resolve conflicts | You reconcile the branch and master versions step by step in the conflict resolution view. |
| Merge anyway | The branch version becomes the new master version, replacing the newer changes on master. |
Merge with assistant
In the merge dialog, click Merge with assistant to have the mabl assistant combine the changes from master and your branch, check the result, and merge the branch for you. To follow the merge, click View assistant session.
For each conflicting test or flow, the assistant:
- Compares what changed on master and what changed on your branch since the branch was created.
- Adds master’s changes to the version on your branch. Where both sides changed the same step, the assistant uses what it knows about the test’s purpose and each edit to decide what to keep.
- Re-reads the updated version to confirm the changes saved.
- Runs the test on the branch. For a flow, the assistant runs a test that uses the flow.
Once every conflicting test and flow is reconciled and passing, the assistant merges the branch into master. If the assistant can’t reconcile a test or flow, or the test doesn’t pass, it stops and reports which one needs attention. Nothing merges, and master stays as it was.
Resolve conflicts
To reconcile a conflict yourself, click Resolve conflicts next to the test or flow in the merge dialog, or click the red exclamation icon in the Conflicts column of the branch details view. Either one opens the conflict resolution view.
The conflict resolution view
The conflict resolution view appears as a three-columned table with the following sections:
- Master version: steps appear in red if they don’t exist on the test branch.
- New version: a space to create the new version that you will save to your test branch before merging.
- Test branch version: steps appear in green if they don’t exist on the master branch.
Steps that appear in white exist on the master and test branch version, and you cannot change them.
To create a new version, click on the arrows to move steps and flows into the new version column. If there are conflicts in data-driven variables and flow parameters, the conflict resolution view also includes options for selecting the variables or values you’d like to use in the new version.
When you’re satisfied with the steps, variables, and parameters selected for the new version, click Preview to check over the final version. You may return to the previous editing page and make changes if needed. If everything looks correct, click Save to create the new version on the test branch, then merge the branch.
Merge anyway
To merge the branch version as is, click Merge anyway. mabl saves the branch version as a new master version, replacing the newer changes on master. The earlier master version stays in the version history, so you can revert to it if needed.
Merge from the mabl CLI or an AI client
You can also merge branches from the mabl CLI or from an AI client connected to the mabl MCP.
In the mabl CLI, use mabl branches merge. The CLI can merge into any branch, not only master. How it handles conflicts depends on the option you use:
- With no option, the CLI saves the branch version as the latest version on the branch you merge into, like Merge anyway.
- With
--fast-forward-only, the CLI refuses to merge if there are conflicts. - With
--agentic, the CLI starts a merge with the assistant when there are conflicts. It only merges into master. Track the session withmabl branches merge-status --from {branch} --session-id {session-id}untilbranch_mergedistrue.
To check for conflicts before you merge, run mabl branches merge-status --from {branch}. For all options, see the mabl CLI command reference.
With the mabl MCP, ask your AI client to merge the branch and, if it conflicts, to have the mabl assistant reconcile it. For example:
Merge my mabl branch promo-update into master. If it conflicts, have the mabl assistant reconcile it.
Your AI client asks before it starts a merge with the assistant. Without your go-ahead, a branch with conflicts isn't merged. See mabl cloud MCP tools for the tools involved.
After you merge
Once the branch is merged, the new version is labeled "Merged X into master" in the version history.
You cannot reopen it or run tests against the merged branch.
Revert a merge
Sometimes the merged version of a test or flow results in unintended consequences. While you cannot restore all tests and flows from a merged branch version, you can restore earlier versions of individual tests or flows using the following steps:
- Go to the details page of the test or flow that you wish to revert.
- Click on the Change history tab.
- Select the older version that you wish to revert to.
- Click on the Save as latest button.
This process must be done separately for each merged test and flow that you wish to revert.
Delete a branch
After a branch is merged to master, it still appears on the branches page. To delete a branch, click on the trash icon next to it.
Once you delete a branch, it cannot be recovered or restored.
Limitations
- API tests do not support conflict resolution.
- The mabl Desktop App only supports merging from a test branch to the master branch. You cannot merge changes to another test branch, or pull the latest changes from master into a test branch on the Desktop App.
- Merge with assistant only supports browser tests, and only merges into master.