Reputation: 12514
I have a project with a natural long-term branch cum fork; I won't want to re-merge this with the default branch. I initially managed this fork with a bookmark, but on reflection it seemed to make more sense to have this as a named branch, so (without thinking about it too much) I created a branch at the bookmarked head (4).
o 7:default
|
| o 6:fork
| |
| o 5:fork
| |
| o 4:default
| |
o | 3:default
| |
| o 2:default
|/
o 1:default
|
o 0:default
But this means that I now have a branch plus a lonely head (4) on the default
branch which isn't going to go anywhere (because it's really part of the branch/fork, and I don't plan to commit to (4) on the default
branch). But this means that the repository is now somewhat untidy: I have a fork which exists partly on the default
branch and partly, later, on the named branch and which, because it's on default
looks as if it should be merged later. And oooh, that untidiness is a terrible thing (perhaps I should get out more).
What I'd like is either (a) to magically put selected revisions (ie, the ones leading to the now lonely head) onto the named branch, or (b) go back to plan A (bookmarks) and retrospectively put revisions on the named branch (5 & 6) back on the default
branch and add a bookmark.
Possibilities:
hg convert
to create a copy of the repository minus the fork, create the branch, and start hand-applying changesets. Messy and rather error-prone, but doable (there aren't too many revisions in the branch).I'm holding out for magic.
Upvotes: 0
Views: 48
Reputation: 2807
Ghost merge. Merge revision 4 into revision 7. Discard all changes of rev. 4 when doing the merge.
Close the head. Update to rev. 4, close the branch there.
Rebase. If revisions 2, 4, 5, 6 are in the draft
phase. You can rebase starting from rev. 2, moving all descendants to another branch.
Options 1 and 2 will only hide the unwanted head (history unchanged). To rewrite history, go with option 3.
default
. Using bookmarks again, as the branch never existed.Upvotes: 1