hg-add(1)

hg-add1

Add the specified files on the next commit

Usage

hg add [OPTION]... [FILE]...

Overview

Schedule files to be version controlled and added to the repository.

The files will be added to the repository at the next commit. To undo an add before that, see hg forget.

If no names are given, add all files to the repository (except files matching .hgignore).

Examples:

•

New (unknown) files are added automatically by hg add:

$ ls
foo.c
$ hg status
? foo.c
$ hg add
adding foo.c
$ hg status
A foo.c
•

Specific files to be added can be specified:

$ ls
bar.c  foo.c
$ hg status
? bar.c
? foo.c
$ hg add bar.c
$ hg status
A bar.c
? foo.c

Returns 0 if all files are successfully added.

Options

-I,--include <PATTERN[+]>

include names matching the given patterns

-X,--exclude <PATTERN[+]>

exclude names matching the given patterns

-S, --subrepos

recurse into subrepositories

-n, --dry-run

do not perform actions, just print output

[+] marked option can be specified multiple times

From mercurial 7.2.4-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.