dolt-commit
Save changes to the Dolt database
TLDR
Commit all staged changes, opening the editor specified by $EDITOR to enter the commit message
Commit all staged changes with the specified message
Stage all unstaged changes to tables before committing
Use the specified ISO 8601 commit date (defaults to current date and time)
Use the specified author for the commit
Allow creating an empty commit, with no changes
Ignore foreign key warnings
SYNOPSIS
dolt commit [options]
PARAMETERS
-m <msg>, --message <msg>
Use the specified <msg> as the commit message. Multiple -m options can be provided; their messages will be concatenated.
-a, --all
Automatically stages all modified and deleted tables before committing. This bypasses the need to run dolt add manually for these changes.
--amend
Used to modify the most recent commit. This operation rewrites history by replacing the last commit with a new one that includes any currently staged changes and the original (or a new) commit message.
--author <author>
Overrides the commit author. The format should be "Author Name <email@example.com>".
--date <date>
Overrides the commit date. This can be specified in various formats, such as an RFC 2822 date or a UNIX timestamp.
--allow-empty
Permits creating a commit even if there are no changes staged. This is useful for marking a specific state or for creating a starting point in an empty repository.
--no-edit
Uses the provided commit message (e.g., with -m or --file) without launching an external editor.
--file <file>
Takes the commit message from the specified file instead of opening an editor or using -m.
--cleanup=<mode>
Specifies how the auto-generated commit message (e.g., from --amend) should be cleaned up. Common modes include strip (strip comments and whitespace), whitespace (only strip leading/trailing whitespace), verbatim, and scissors.
DESCRIPTION
dolt-commit is a foundational command within the Dolt version control system for databases. It operates analogously to git commit, taking all changes that have been explicitly staged using dolt add (or automatically staged with the -a/--all option) and permanently recording them as a new snapshot in the database's history.
Each successful commit creates an immutable point-in-time representation of the database's schema and data. These commits are linked together, forming a directed acyclic graph (DAG) that constitutes the complete version history of the Dolt database, enabling powerful operations like branching, merging, diffing, and reverting data and schema.
A commit message is mandatory and should succinctly describe the changes introduced in the snapshot, aiding future understanding and navigation of the database's evolution.
CAVEATS
Using the --amend option rewrites the commit history. While useful for local changes, it should be used with extreme caution on branches that have already been pushed to a remote Dolt database, as it can cause conflicts for collaborators.
Unless the --all or --allow-empty options are used, dolt commit requires that changes have been previously staged using dolt add.
COMMIT MESSAGE BEST PRACTICES
A well-crafted commit message is crucial for understanding the history of your Dolt database. It should typically consist of a concise, single-line summary (under 50-72 characters) followed by a blank line and then a more detailed explanation of the changes. The summary should be in the imperative mood (e.g., "Add new 'users' table" rather than "Added new 'users' table"). Clear messages greatly enhance collaboration and future maintainability.
ATOMIC COMMITS
It is generally considered good practice to make 'atomic' commits, meaning each commit should represent a single, logical change. This makes the history easier to understand, revert, or cherry-pick specific changes if needed. For example, separate schema changes from data changes, or changes to one table from changes to another, into distinct commits.
HISTORY
dolt-commit is a core component of Dolt, a unique SQL database that blends traditional relational database features with Git-like version control capabilities. Dolt was created by DoltHub (formerly Liquidata) and first publicly released around 2019. The concept of commit is central to Dolt's design, directly inspired by Git's model of atomic snapshots. From its inception, dolt commit has been the primary mechanism for users to save and track changes to both schema and data, enabling the robust versioning, branching, and merging that defines the Dolt experience.
SEE ALSO
dolt add(1), dolt status(1), dolt log(1), dolt branch(1), git commit(1)