Forrest logo
back to the hg tool

hg-init:tldr:19c32

hg-init: Initialize a new repository in the current directory.
$ hg init
try on your machine

The command "hg init" is used in Mercurial, a distributed version control system, to create a new, empty repository.

When you run "hg init" in the command line or terminal, it initializes a new Mercurial repository in the current directory. It sets up the necessary files and directories to store the version history, metadata, and configuration for the repository.

After running "hg init," you will find a hidden directory named ".hg" in the current directory, which contains the repository files and directories. These include the "store" directory to store the actual data, "data" directory to store metadata, a configuration file named "hgrc" for repository settings, among others.

Once the repository is initialized, you can start adding files, making commits, and managing your project's version history using other Mercurial commands like "hg add," "hg commit," and so on.

It's worth mentioning that before running "hg init," ensure that you are in the desired directory as it will create the repository in the current folder and its subdirectories.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the hg tool