hg-init

creates a new Mercurial repository in the specified directory or current

TLDR

Create repository in current directory
$ hg init
Create repository in new directory
$ hg init [project-name]

SYNOPSIS

hg init [options] [dest]

DESCRIPTION

hg init creates a new Mercurial repository in the specified directory or current directory if none given. It creates a .hg subdirectory containing all version control data. After initialization, use hg add to track files and hg commit to save changesets. The working directory contains the source files while .hg stores the repository history.

PARAMETERS

DEST

Directory to create the repository in; created if it doesn't exist. Defaults to the current directory.
-e, --ssh CMD
Specify ssh command to use (for remote destinations).
--remotecmd CMD
Specify hg command to run on the remote side.
--insecure
Do not verify the server certificate.
--help
Display help information.

INSTALL

sudo apt install mercurial
sudo dnf install mercurial
sudo pacman -S mercurial
sudo apk add mercurial
sudo zypper install mercurial
brew install mercurial
nix profile install nixpkgs#mercurial

CAVEATS

Fails if the destination already exists as a non-empty, non-repository directory. Initializing inside an existing repository creates a nested repo, which is usually unintended.

HISTORY

Init is a core Mercurial command, present since the project's first release in 2005.

SEE ALSO

hg(1), hg-add(1), hg-commit(1), hg-clone(1)

RESOURCES

Source code · Documentation