LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

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

--share-source

Print the share source root instead, when the repository was created with the share extension.
-T, --template TEMPLATE
Display output with the given template.
--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)

RESOURCES

Copied to clipboard
Kai