2017-12-14 05:22:24 +00:00
|
|
|
# hg add
|
|
|
|
|
|
|
|
> Adds specified files to the staging area for the next commit in Mercurial.
|
2019-06-03 02:06:36 +02:00
|
|
|
> More information: <https://www.mercurial-scm.org/doc/hg.1.html#add>.
|
2017-12-14 05:22:24 +00:00
|
|
|
|
|
|
|
- Add files or directories to the staging area:
|
|
|
|
|
|
|
|
`hg add {{path/to/file}}`
|
|
|
|
|
|
|
|
- Add all unstaged files matching a specified pattern:
|
|
|
|
|
2025-04-25 14:45:48 +03:00
|
|
|
`hg add {{[-I|--include]}} {{pattern}}`
|
2017-12-14 05:22:24 +00:00
|
|
|
|
|
|
|
- Add all unstaged files, excluding those that match a specified pattern:
|
|
|
|
|
2025-04-25 14:45:48 +03:00
|
|
|
`hg add {{[-X|--exclude]}} {{pattern}}`
|
2017-12-14 05:22:24 +00:00
|
|
|
|
|
|
|
- Recursively add sub-repositories:
|
|
|
|
|
2025-04-25 14:45:48 +03:00
|
|
|
`hg add {{[-S|--subrepos]}}`
|
2017-12-14 05:22:24 +00:00
|
|
|
|
|
|
|
- Perform a test-run without performing any actions:
|
|
|
|
|
2025-04-25 14:45:48 +03:00
|
|
|
`hg add {{[-n|--dry-run]}}`
|