简体   繁体   English

主提交然后与另一个分支合并

[英]Master commit then merge with another branch

I've never tried this before. 我以前从未尝试过。 Suppose that you have two branches "master" and "aBranch", you create aBranch then commit master branch which is ahead of aBranch. 假设您有两个分支“ master”和“ aBranch”,则创建一个aBranch,然后提交在aBranch之前的master分支。 Always I merge with branch that are ahead of master but not in reverse. 我总是与领先于分支机构的分支合并,但不能反向合并。 What will happen if you merge master (which is ahead) with aBranch when no conflicting files are involved? 如果在不涉及冲突文件的情况下将母版(位于前面)与aBranch合并,将会发生什么情况?

It depends on the relationship between master and aBranch . 这取决于masteraBranch之间的关系。 If your history looks something like this: 如果您的历史记录如下所示:

* (master)
|
*
|
* (aBranch)

then nothing happens, since master can already reach every commit reachable from aBranch . 那么什么也没发生,因为master已经可以到达aBranch可以到达的每个提交。

If, instead, you have something like 相反,如果您有类似

* (master)
|
*  * (aBranch)
|  |
*  *
| /
*

then you get just what you would if you tried to merge the other way. 那么您将获得尝试合并另一种方式所得到的结果。 The only difference is the order in which the merge commit stores its two parents, and which branch head is advanced. 唯一的区别是合并提交存储其两个父级的顺序以及前进的分支头的顺序。

* (master)
| \
*  |
|  |
*  * (aBranch)
|  |
*  *
| /
*

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM