开发者

Push mercurial merged branch without history

开发者 https://www.devze.com 2023-04-10 08:40 出处:网络
Given that I have created a branch in Mercurial how can I push the re开发者_JS百科sulting merge of that branch to a remote repository without the history of how I got to that merged branch result. For

Given that I have created a branch in Mercurial how can I push the re开发者_JS百科sulting 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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号