Question

I have created a feature branch in the next fashion: hg branch feature/issue-number.

I made a commit with my changes, and wanted to push this branch. I typed hg push --new-branch -b feature/issue-number, and mercurial said: abort: unknown branch 'feature/issue-number'.

I typed hg branch and it printed feature/issue-number.

I typed hg update default and it printed 0 files updated, 0 files merged, 0 files removed, 0 files unresolved.

Then I typed hg branch again. I expected to see default in output, but there was still feature/issue-number.

Can anyone explain me what's going on?

Was it helpful?

Solution

You need to commit. In Mercurial, branch are permanent information recorded in the commit itself. After you typed hg branch babar your "working copy" got changed to branch babar but there won't be any commit on this branch until you create an actual commit from your working copy with hg commit. You can use hg summary at any time to undersrand the state of your repository.

Mercurial has a lighter concept called "bookmark" that allows to reference changesets without permanente records in the commit itself. You should check it out before going commiting yourself into using named branch.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top