Last weekend I spent many hours (and many commits) working on a line of development that I now think is a mistake. I don’t want to throw away the work I did, though; I’d like to leave it in the project history.
Problem is, I’ve merged several times from the mainline of development in my public repository. Therefore, once I push to the public repository, the “mainline” will become the line of development I thought was a mistake. (Plus, everyone’s client complains about new heads popping up everywhere)
How should I handle this case?
hg rebaseis what you’re looking for. You would create a ‘dead-end’ branch, rebase the commits onto there, and then your default branch isn’t affected, but dead-end is still in the repo history.There will still be an extra head, but, well, there is an extra head. You can still
--close-branchto get rid of it like any other branch.