Search code examples
version-controlmercurial

Newly created Mercurial branch is not recognized by branches sub command


If I create a branch using hg branch, a new branch is created.

λ hg branch new-branch
marked working directory as branch new-branch

λ hg identify -b
new-branch

Now, if I want to see all created branches, I don't see this branch.

λ hg branches -c
branch2                       13:3d2ed95e15b6
default                       10:556b09dd352b
test2                         12:f15ad58b843e (closed)
test1                         11:9fe883cc2d04 (closed)

Is there any branch subcommand switch to see this branch also ?


Solution

  • The problem here is that the branch you're on does not yet exist. hg branches lists the branches that exist. Your proposed new commit (in your working tree) will go onto the new branch new-branch, at which point new-branch will exist, because it will have a commit within it. But until then it's more of a hypothetical branch: a branch that doesn't exist yet.

    (Both hg branch and hg summary will tell you which branch you're on.)