← 返回命令列表

Linux command

hg-branch 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Show current branch

hg branch

Create a new branch

hg branch [branch-name]

List all branches

hg branches

Switch to a branch

hg update [branch-name]

Close current branch

hg commit --close-branch -m "[message]"

说明

hg branch manages named branches in Mercurial. Without arguments, it shows the current branch name. With a name argument, it marks the working directory as being on a new branch, which takes effect on the next commit. Named branches are permanent parts of changeset history. For lightweight Git-style branches, use hg bookmark instead.

参数

-f, --force
Set branch name even if shadowing an existing branch.
-C, --clean
Reset branch name to parent branch name.

FAQ

What is the hg-branch command used for?

hg branch manages named branches in Mercurial. Without arguments, it shows the current branch name. With a name argument, it marks the working directory as being on a new branch, which takes effect on the next commit. Named branches are permanent parts of changeset history. For lightweight Git-style branches, use hg bookmark instead.

How do I run a basic hg-branch example?

Run `hg branch` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -f, --force do in hg-branch?

Set branch name even if shadowing an existing branch.