GIT:如何在不实际合并文件的情况下合并两个分支(简单合并) [英] GIT: how to merge two branches without actually merging files (trivial merge)
问题描述
git中有没有一种方法可以合并两个分支而不合并文件?换句话说,只是绘制合并箭头.
Is there a way in git to merge two branches without merging file? In other words just to draw the merge arrow.
假设我有分支A和B.我需要将分支B合并到A,但是不需要B中的所有更改,而只需要链接到分支.
Let say I have branches A and B. I need to merge branch B to A, but no need all the changes in B, but rather only need to link to branches together.
git checkout A
git merge B --no need changes
通常,有一种方法可以合并两个不带子模块的分支.我想保留子模块,就像它在分支A中一样,仍然需要合并分支B.
In general is there a way to merge two branches without submodules. I want to keep submodules as it is in Branch A and still need to merge branch B.
更新
git merge -s我们的BRANCH_NAME为我工作了.
git merge -s ours BRANCH_NAME worked for me.
推荐答案
使用 git merge -s我们的B
进行合并,丢弃B会带来的任何更改.尽管如此,来自 B
的提交现在位于 A
中,但是,合并之前文件处于 A
的状态.
Use git merge -s ours B
to perform a merge discarding any changes B would introduce. Still, the commits from B
are now in A
, however, the files are at the state of A
before the merge.
这篇关于GIT:如何在不实际合并文件的情况下合并两个分支(简单合并)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!