Files
cheatsheet-tldr/tldr/hg-add
2025-04-26 00:18:47 +00:00

30 lines
690 B
Plaintext

---
syntax: markdown
tags: [tldr, common]
source: https://github.com/tldr-pages/tldr.git
---
# hg add
> Adds specified files to the staging area for the next commit in Mercurial.
> More information: <https://www.mercurial-scm.org/doc/hg.1.html#add>.
- Add files or directories to the staging area:
`hg add {{path/to/file}}`
- Add all unstaged files matching a specified pattern:
`hg add {{[-I|--include]}} {{pattern}}`
- Add all unstaged files, excluding those that match a specified pattern:
`hg add {{[-X|--exclude]}} {{pattern}}`
- Recursively add sub-repositories:
`hg add {{[-S|--subrepos]}}`
- Perform a test-run without performing any actions:
`hg add {{[-n|--dry-run]}}`