Forrest logo
back to the hg tool

hg-update:tldr:32c42

hg-update: Update and discard uncommitted changes.
$ hg update --clean
try on your machine

The command hg update --clean is used in Mercurial (hg) version control system to update the currently checked out branch to another branch or revision, while also discarding any uncommitted changes.

Here is a breakdown of the command:

  • hg update: This is the main command used to update the repository to a specific revision or branch. It is similar to the "checkout" command in other version control systems.
  • --clean: This is an option used with the update command and indicates a clean update. When used, it discards any uncommitted changes in the working directory before performing the update. This ensures that the state of the working directory matches exactly with the target branch or revision.

When you run hg update --clean, Mercurial will update your repository to the specified branch or revision and remove any uncommitted changes, giving you a clean working directory with the updated code. It's worth noting that any uncommitted changes will be lost, so make sure to commit or backup your changes if needed before running this command.

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