Let’s say I have a mercurial project and I do this:
hg branch whatever
touch newfile
hg add newfile
hg commit -m "added newfile" --close-branch
hg up -C default
hg merge whatever
hg push
abort: push creates new remote branch 'whatever'!
(did you forget to merge? use push -f to force)
How can I remove the branch so that hg branches -c will not show it there? It’s kind of frustrating that this is not allowing me to push to bitbucket. I read the Documentation, but the first two points I’m probably not following correctly ( since I keep getting the error, even though I merged ). The third point, about removing via clone I don’t understand how to do, since I always end up with the feature branch in my repo too.
Well, first of all, you don’t have to remove that branch.
The warning is just that, a warning that you should double-check that you’re indeed doing the right thing, and not pushing a branch somewhere it doesn’t belong.
However, if you want to keep the branch, just do what the warning says, push with the
-foption:Now, on the other hand, if you do want to remove it, here’s the ways you can do it:
Strip
If you have the “mq” extension enabled, you can strip off the changeset:
This removes the revision REV, and everything that follows from it, from the repository.
You should only do this in a clone if you’re unsure about the effect or whether you really want this
MQ
Another way is to pop the changesets you don’t want to push into a queue. I don’t know if this will work with a whole branch, neither do I know the exact command for this.
Clone
Basically you clone what you want to keep
This will clone from
originaltonewcloneand only clone the default branch. If you want to clone more than the default branch, you can repeat the--branch NAMEoption for each branch you want to clone.Again, make sure you experiment with fresh clones and verify that you get what you want before pushing anything to the central repository.