8

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.

0

2 Answers 2

7

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.

Sign up to request clarification or add additional context in comments.

1 Comment

That did it! Thanks for all the links. Now I wish I could figure out how to get TortiseHg to do that correctly.
0

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

No ways to get stripped history for merged branches

1 Comment

In as-is form, but [Collapse extention] (mercurial.selenic.com/wiki/CollapseExtension) can help

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.