Forrest logo
back to the hg tool

hg-add:tldr:e3711

hg-add: Perform a test-run without performing any actions.
$ hg add --dry-run
try on your machine

The hg add --dry-run command is used in the Mercurial version control system to simulate adding files to the repository without actually modifying the repository. When you run this command, Mercurial will scan the repository and the working directory to identify any files that are not currently tracked by the repository.

Here's how the command works:

  • hg: This is the command to invoke the Mercurial system.
  • add: This is the sub-command used to add files to the repository.
  • --dry-run: This is an option that tells Mercurial to perform a dry run, which means that it will only simulate the operation without actually making any changes to the repository.

By using the --dry-run option, you can see a list of files that would be added to the repository if you were to run the command without the option. This can be useful to verify the outcome of the command and check if it will include the desired files or directories.

For example, running hg add --dry-run might output a list like this:

adding file1.txt
adding file2.txt
ignoring directory1/

This indicates that file1.txt and file2.txt would be added to the repository, but the directory1/ directory would be ignored.

Overall, the hg add --dry-run command provides a way to preview the changes that would be made when adding files to the Mercurial repository, helping you ensure everything is in order before proceeding with the actual operation.

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