在两个方向上合并两个分支

在两个方向上合并两个分支

本文介绍了在两个方向上合并两个分支 - 有什么理由或完全禁止?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的同事最近要求我帮助他预先提交钩子,以阻止中央回购。这是着名的


$ b checkheads.py 的算法在分支中收集头忽略来自其他分支的更改(b):

  for x in xrange(p + 1,end):
如果repo [x] .branch( )!=分支:
继续

历史记录包含默认 prod 然后从 prod 返回到默认 因为任何来自 prod 分支的路径都被剥离,所以c $ c> checkheads.py 没有发现在 default 合并的 default 分支中的几个头(但 hg heads 报告单个原样)。



我的问题有什么有用的DVCS工作流程需要在两个分支之间以两种方式进行合并? 没有交叉合并。 p>

是否可以防止来回合并?

解决方案

根据功能分支(gitflow,github-flow,...),你想使用pull请求进行合并(参见例如github的一次点击合并)。

如果您正在使用某项功能,并且某人已经合并了修改相同文件的功能,并且如果要合并,则会发生冲突。

如果您想要合并您的拉取请求,您必须先解决这些冲突。



您有两种可能:


  • 重贴,但这并非总是可行一些非常好的理由)

  • 从您的父分支合并到您的功能分支中。



如果您以这种方式成功合并,您可以合并您的pull请求/功能分支,并且最终会出现一个美丽的十字交叉;-)


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?

解决方案

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 ;-)

这篇关于在两个方向上合并两个分支 - 有什么理由或完全禁止?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-31 09:55