Merges between two branches in two directions - any good reason or completely forbid?

一世执手 提交于 2019-12-31 03:53:28

问题


My colleague recently ask me to help him with precommit hook which block push to central repo. This is famous https://hg.python.org/hooks/file/tip/checkheads.py

Algorithm of checkheads.py gather heads in branch ignoring changes from another branches by piece:

for x in xrange(p + 1, end):
    if repo[x].branch() != branch:
        continue

History contains merges from default to prod and then back from prod to default.

So checkheads.py didn't find that changesets merged at default (connected in graph) becase any path from prod branch are stripped and script report several heads in default branch (but hg heads reports single as it is).

My question what useful DVCS workflow require merges between two branches in two way?

Famous http://nvie.com/posts/a-successful-git-branching-model/ doesn't have cris-cross merges.

Is it ok to prevent merges back and forth?


回答1:


My question what useful DVCS workflow require merges between two branches in two way?

Take every workflow based on feature branches (gitflow, github-flow,...), where you want to merge using pull requests (see the one click merge of github for example).

If you are working on a feature and someone has already merged a feature that modify the same files and you have conflicts if you want to merge.

If you want to merge your pull request, you will have to solve these conflicts first.

You have 2 possibilities :

  • rebase but that's not always possible (for some very good reasons)
  • merge from your parent branch into your feature branch.

If you successfully merged in this way, you could merge your pull request / feature branch and you will end up with a beautiful criss cross ;-)



来源:https://stackoverflow.com/questions/32402715/merges-between-two-branches-in-two-directions-any-good-reason-or-completely-fo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!