Forrest logo
back to the hg tool

hg-add:tldr:b329f

hg-add: Add all unstaged files matching a specified pattern.
$ hg add --include ${pattern}
try on your machine

This command is used in the Mercurial (hg) version control system to add files or directories matching a specific pattern to the repository.

The hg add command is used to mark files or directories as "tracked" in the repository, so that they will be included in the version history and can be committed. By default, only new files are added, while modifications to already tracked files are automatically included.

In this specific command, --include is an option that specifies a pattern or a list of patterns to match the files or directories to be added. The ${pattern} is a placeholder for the actual pattern you would provide.

For example, if you want to add all files in the current directory with a ".txt" extension, you can use the following command: hg add --include "*.txt". The *.txt is the pattern that matches all files with the ".txt" extension.

You can also specify multiple patterns separated by spaces, like hg add --include "*.txt" "*.md", to add files with either a .txt or .md extension.

Note that the hg add command only stages the changes, and you still need to use the hg commit command to permanently save the changes to the repository.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the hg tool