Forrest logo
back to the hg tool

hg-push:tldr:ac976

hg-push: Push a new branch if it does not exist (disabled by default).
$ hg push --new-branch
try on your machine

The command "hg push --new-branch" is used in Mercurial to push a new branch to a remote repository. Let's break down the command:

  • "hg" refers to the Mercurial version control system and is used as a prefix for all Mercurial commands.
  • "push" is used to push changesets from your local repository to a remote repository.
  • "--new-branch" is an option that tells Mercurial to push the changesets as a new branch in the remote repository.

When you execute the "hg push --new-branch" command, Mercurial will check the changesets in your local repository that have not been pushed yet. It will then transfer those changesets to the remote repository and create a new branch there, using the same branch name as in your local repository.

This command is useful when you want to start working on a new feature or topic in your local repository and push it to a shared repository for collaboration. By using the "--new-branch" option, you can ensure that the changesets are pushed as a separate branch, keeping the history organized and allowing others to easily identify and review the changes related to that branch.

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