Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
840 views
in Technique[技术] by (71.8m points)

branching and merging - Is it correct to do a merge of named branch with the default Mercurial branch?

I have hit following issue regarding Mercurial usage. I have two branches: default branch and let's say A branch. After establishing the A branch (point 1 in my diagram below) there were done some modifications on the default branch (point 2 in my diagram below) so the situation is following

                1             2
----default-----o-------------o
                 
                  
                   -----A------

My goal is to have the changes from the default branch (from point 2) on the A branch. My idea was to use the hg merge default command for this. I have searched this forum and I have found similar question. Based on that it seems to me that my intention is at least doable but I am not sure whether it is correct approach because I have thought that the merges including the default branch should be done only in direction: named branch->default branch. My question is whether the approach I have suggested above i.e. do a merge with default branch is correct?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This isn't really a matter of "right or wrong". Technically Mercurial supports what you propose. You can merge from any branch into any other branch.

The question is what is the best thing for your workflow. If the problem is that changes were made on default that should have been made on A, then a merge from default to A seems appropriate. But there also could be alternative ways of making such a correction (if indeed that is what is required). The question doesn't have enough information to really elaborate on this, however.

If the intention is to do new feature development on branches, and then only merge the completed results of that work onto default, that seems reasonable, and I think is a common approach.

Regardless, if you haven't already you should carefully define what work is expected to be done on what branch, just to avoid confusion & mistakes.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...