Subversion有 - 只为合并记录,我如何在Git中做同样的事情? [英] Subversion has --record-only for merges, how do I do the same in Git?

查看:100
本文介绍了Subversion有 - 只为合并记录,我如何在Git中做同样的事情?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个repo,其中'master'正朝着某个方向前进,而第二个分支'foo'将在两次提交之间发散,然后追踪所有后续对'master'的更改。这是所有的选择。



在Subversion中,你可以做一个--record-only合并,将事情标记为合并已发生,即使没有实际改变承诺。即,这改变了目标分支中的目录附属的属性中的合并跟踪号码。



我玩过..


git merge --no-commit master


.. as something I may在进行提交之前能够修改它,但是对于目标分支的部分更改(重命名后面跟着删除)而言,它是一团糟。



必须有更简单的方法..?




  • Paul
  • >

解决方案

这是您要查找的内容吗?

  git merge --strategy = our master 




我们

这可以解析任意数量的头,但合并的结果树始终是当前分支头的树,有效地忽略了所有更改来自所有其他分支。它是用来取代旧分支的旧发展历史。


这似乎是你要求的 - 它创建一个合并提交,实际上并没有引入任何更改。



但是,你真的想这样做吗?是否有某些理由让你不能让分支实际发生分歧(没有发生合并),然后再合并?


I have a repo where 'master' is going in a certain direction, and a second branch 'foo' is going to be divergent for a couple of commits, then track all subsequent changes to 'master' after that. This is all by choice of course.

In Subversion you could do a --record-only merge to mark things as "merge has happened" even though no actual changes were committed. i.e. this change the merge-tracking numbers in properties attached to directories in the target branch.

I have had a play with..

git merge --no-commit master

.. as something I may be able to tinker with before I do the commit, but it is making a hell of a mess of the target branch for part of the change in question (rename followed by delete).

There must be an easier way.. ?

  • Paul

解决方案

Is this what you're looking for?

git merge --strategy=ours master

ours

This resolves any number of heads, but the resulting tree of the merge is always that of the current branch head, effectively ignoring all changes from all other branches. It is meant to be used to supersede old development history of side branches.

This seems to be what you're asking for - it creates a merge commit which doesn't actually introduce any changes.

But do you really want to do this? Is there some reason you can't just have the branches actually diverge (without a merge happening) then merge later?

这篇关于Subversion有 - 只为合并记录,我如何在Git中做同样的事情?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆