LinuxCommandLibrary

dolt-init

Initialize a new Dolt repository

TLDR

Initialize a new Dolt data repository in the current directory

$ dolt init
copy

Initialize a new Dolt data repository creating a commit with the specified metadata
$ dolt init --name "[name]" --email "[email]" --date "[2021-12-31T00:00:00]" [[-b|--initial-branch]] "[branch_name]"
copy

SYNOPSIS

dolt init [options]

PARAMETERS

--branch=<name>
    Sets name of initial branch. Default: main.

--force
    Overwrites existing .dolt directory if present.

DESCRIPTION

Dolt is a SQL database with Git-like version control for data, schema, and code. The dolt init command creates a new Dolt repository in the current directory, setting up a .dolt hidden folder with initial database files and an empty commit on the default main branch.

This enables tracking changes to tables, rows, and schema like code in Git. Post-init, users can run SQL via dolt sql, add tables/data with dolt add, and commit versions with dolt commit. It's the first step for any Dolt project, similar to git init but for databases.

Dolt supports branches, merges, diffs, and collaborative workflows. Initialization is fast and works in any empty directory. Without options, it uses standard defaults. Ideal for data engineering, analytics, or any data needing history and collaboration.

CAVEATS

Fails if .dolt exists without --force. Avoid nesting Dolt repos. Current directory becomes the repo root.

EXAMPLE

dolt init
Initializes with default main branch.

dolt init --branch dev --force
Forces init on dev branch, overwriting if needed.

NEXT STEPS

Run dolt sql for queries.
dolt add to stage changes.
dolt commit -m "Initial commit" to version.

HISTORY

Introduced in Dolt v0.1.0 (2019) by DoltHub. Default branch switched from master to main in v0.28.0 (2020). Actively developed for SQL+Git features.

SEE ALSO

git-init(1), dolt(1), dolt-sql(1)

Copied to clipboard