dolt-merge
Merge changes from one branch into another
TLDR
Incorporate changes from the named commits into the current branch
Incorporate changes from the named commits into the current branch without updating the commit history
Merge a branch and create a merge commit even when the merge resolves as a fast-forward
Merge a branch and create a merge commit with a specific commit message
Abort the current conflict resolution process
SYNOPSIS
dolt merge [options] commit-ish
PARAMETERS
commit-ish
The branch name, tag, or commit hash to merge into the current HEAD.
-m, --no-ff
Create a merge commit even if the merge could be resolved as a fast-forward. This ensures a merge commit is always created.
-ff-only
Only perform a fast-forward merge. Fail if the merge cannot be resolved as a fast-forward.
--abort
Abort the current merge in progress, restoring the state before the merge attempt.
--continue
Continue the merge after resolving conflicts. This should be used after manually fixing conflicts.
--squash
Perform the merge and stage the changes, but do not create a merge commit. The user can then commit these changes as a single, new commit.
--allow-empty-commit
Create a merge commit even if no changes result from the merge. This is typically used with --no-ff.
--allow-data-conflict
Allows data conflicts to persist in the database after the merge. Use with extreme caution, as it can lead to inconsistent states.
--allow-schema-conflict
Allows schema conflicts to persist in the database after the merge. Use with extreme caution, as it can lead to inconsistent states.
-q, --quiet
Suppress non-error messages during the merge process.
-v, --verbose
Show more detailed output during the merge process.
-Xstrategy, --strategy=strategy
Specify the merge strategy. Currently, 'recursive' is the primary and default strategy in Dolt.
DESCRIPTION
dolt-merge is a fundamental command in Dolt, a version-controlled SQL database. It functions analogously to git merge, allowing users to integrate changes from one Dolt branch or commit into another. When executed, dolt-merge attempts to combine the history of two diverging lines of development. It handles both schema (table definitions) and data (row content) conflicts. If a fast-forward merge is possible, where the current branch's head is an ancestor of the merged branch's head, Dolt will perform a fast-forward by default, simply moving the current branch pointer. Otherwise, it performs a three-way merge, creating a new merge commit that integrates the changes from both branches, resolving conflicts where necessary. Users can explicitly control the merge behavior using various options, such as forcing a merge commit or allowing only fast-forward merges. Conflict resolution is a key aspect, requiring manual intervention for unresolvable differences in schema or data.
CAVEATS
When dolt-merge encounters conflicts, the merge process will pause, and the database will be left in a conflicted state. Users must manually resolve these conflicts (using tools like dolt diff and dolt resolve) before continuing the merge. Using the --allow-data-conflict or --allow-schema-conflict options can leave the database in an inconsistent or problematic state, making future operations difficult and should generally be avoided unless absolutely necessary for specific recovery scenarios.
CONFLICT RESOLUTION WORKFLOW
When dolt-merge encounters conflicts (differences that cannot be automatically resolved), it will leave markers in the affected tables or schemas, and the merge process will pause. The command will provide guidance on how to resolve these conflicts. Users must then manually edit the conflicted tables/schema using standard SQL tools or Dolt's conflict resolution commands (e.g., dolt resolve). After all conflicts are resolved and changes are staged, the merge can be completed by running dolt merge --continue.
MERGE STRATEGIES
While Git offers multiple merge strategies, Dolt primarily uses a recursive strategy for its merges by default. This strategy is robust and capable of handling complex histories involving multiple common ancestors, similar to Git's default merge behavior for complex merges. Other strategies found in Git (like `ours` or `theirs` for path-based resolution) are managed differently in Dolt through explicit table operations or conflict resolution.
HISTORY
Dolt was created by DoltHub, Inc., as a version-controlled SQL database. Its design is heavily inspired by Git, aiming to bring Git-like functionalities (branching, merging, diffing) to databases. dolt-merge is a core command reflecting this design philosophy, enabling collaborative development and schema/data evolution in a highly structured manner, similar to how source code is managed. The first stable release of Dolt was in 2020, and active development continues.