Given that I have created a branch in Mercurial how can I push the resulting merge of that branch to a remote repository without the history of how I got to that merged branch result. For example.
[a] - [b] -----------------[k]
\ /
[g] - [h] - [i] - [j]
[a], [b] and [k] being the 'default' branch, [g] through [j] being the feature branch. Once I merge the feature branch into the default branch how can I have just [a] - [b] - [k] change sets in the remote repository when I push? I don't want to simply not see the branch, I do not want those change sets pushed to the remote repository at all. I don't care how I got to [k], I do care what the [k] end result is though.
I am currently leaning toward the branch by cloning method but how can I accomplish this with cloning? Would there also be a way to make this work with named branches?
I have been looking for an answer to this but there is so much documentation out there it's difficult to find this needle in a haystack.
Instead of merging, you want to use hg rebase with the --collapse option.
hg rebase --collapse --source [g] --dest [b]
The rebase extension is shipped with Mercurial, you just need to enable it in your settings file.
p.s. If you have already committed the merge [k], you should rollback (or strip) it first before rebasing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With