![Forrest logo](/images/logo.png)
hg-commit:tldr:9ffba
hg-commit: Commit staged files to the repository.
$ hg commit
try on your machine
The "hg commit" command is used in the Mercurial version control system to save changes made to your working directory to the repository—it creates a new changeset.
When you run "hg commit," Mercurial will open an editor where you can write a commit message explaining the changes you made. The commit message helps others (and yourself) understand the purpose of the changeset.
The command can also include additional options, such as:
- "-m" followed by a commit message directly in the command, which allows you to avoid opening an editor.
- "-A" to automatically include all changes in your working directory, even new files and deleted files. By default, Mercurial doesn't include these changes.
- "-u" or "--user" followed by your username to specify the author of the commit. By default, the value configured in your Mercurial configuration is used.
- "--amend" to modify the previous commit. This option is used to add additional changes to the previous commit rather than creating a new one.
Keep in mind that after committing, the changes become part of the repository's history and are saved permanently.
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.