I want to have local branch in my cloned repository that will not exist in main repository. To do this I create branch named "new_branch", develop and commit to it. Sometimes I make commites to default branch and after that I make "push -b default" that the branch "new_branch" not appeared in main repository. After the development in "new_branch" finished I make merge to default branch and I want to make push for default branch "push -b default". I get message "abort: push creates new remote branches: new_branch! (use 'hg push --new-branch' to create new remote branches)". Can I have a only local branch in Mercurial?
3 Answers
You can try:
- LocalBranch Extension (only Tim Lee fork seems to work with current Mercurial)
- MQ (and push without
--mqoption)
Comments
Phases can be used for this in modern Mercurial:
# hg phase --secret -r 7::10 Will mark changes 7 through 10 as secret, as so they won't be pushed, pulled, cloned, etc.
2 Comments
Steve Kaye
That won't solve his problem which is that he wants to merge that branch into default without having to push the branch itself.
Paul S
Ahh, I missed that. That would change my response to "Don't do that! The history is valuable"
Once you create a branch using hg branch, it is a permanent part of the changeset. It will always require you to push using the --new-branch option. You cannot strip the branch name without modifying history.
If you want give a local name to a branch that does not get propagated when you push, then you should use hg bookmark instead.