LinuxCommandLibrary

dolt-merge

Merge changes from one branch into another

TLDR

Incorporate changes from the named commits into the current branch

$ dolt merge [branch_name]
copy

Incorporate changes from the named commits into the current branch without updating the commit history
$ dolt merge --squash [branch_name]
copy

Merge a branch and create a merge commit even when the merge resolves as a fast-forward
$ dolt merge --no-ff [branch_name]
copy

Merge a branch and create a merge commit with a specific commit message
$ dolt merge --no-ff [[-m|--message]] "[message]" [branch_name]
copy

Abort the current conflict resolution process
$ dolt merge --abort
copy

SYNOPSIS

dolt merge [options] <commit>

PARAMETERS

-h, --help
    Print help message and exit

--abort
    Abort current in-progress merge, reset HEAD to pre-merge state

--commit, -c
    Auto-commit the merge (default)

--continue
    Continue in-progress merge after resolving conflicts

--ff
    Allow fast-forward merges (default)

--ff-only
    Require fast-forward merge or fail

--no-commit, -n
    Stage merge without committing

--no-ff
    Create merge commit even for fast-forward

--squash, -s
    Squash changes into single commit on current branch

--verbose, -v
    Enable verbose output

DESCRIPTION

The dolt merge command integrates changes from a specified branch into the current branch in a Dolt repository, a SQL database with Git-like version control for tables and schemas. Dolt versions data at the row and table level, enabling precise three-way merges.

By default, it performs a fast-forward merge if possible or creates a merge commit combining histories. Conflicts arise when tables have differing rows or schemas; Dolt marks conflicted tables, requiring manual resolution via dolt conflicts commands before committing.

Options control behavior: --no-commit stages changes without committing, --squash combines them into one commit, and --ff-only restricts to fast-forwards. Aborts or continues in-progress merges are supported. This facilitates collaborative database development, tracking schema evolution and data diffs like code in Git.

Usage assumes a clean working set; uncommitted changes may cause failures. Post-merge, verify with dolt diff or dolt status. Ideal for feature branching workflows in data engineering.

CAVEATS

Must run inside a Dolt repo; uncommitted changes block merges. Table/schema conflicts need manual resolution. No auto-resolution for complex data diffs.

EXAMPLE USAGE

dolt merge develop
dolt merge --no-commit feature-branch
dolt merge --squash --no-ff bugfix

CONFLICT RESOLUTION

Use dolt conflicts resolve and dolt add tables, then dolt commit to complete.

HISTORY

Introduced with Dolt v0.20.0 in 2020 by DoltHub. Evolved from Git-inspired VCS for databases, with ongoing enhancements for SQL-native merging.

SEE ALSO

Copied to clipboard