LinuxCommandLibrary

hg-root

prints the root directory of the Mercurial repository

TLDR

Show repository root

$ hg root
copy
Use in scripts
$ cd $(hg root)
copy

SYNOPSIS

hg root [options]

DESCRIPTION

hg root prints the root directory of the Mercurial repository. It outputs the absolute path to the .hg directory's parent.
The command is useful in scripts to locate the repository root regardless of current working directory. It fails if not in a repository.

PARAMETERS

--help

Display help information.

CAVEATS

Fails if not in repository. Returns absolute path. Simple utility command.

HISTORY

Root is a Mercurial utility command for locating the repository top-level directory.

SEE ALSO

hg(1), git-rev-parse(1), pwd(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community