git合并顺序的区别? [英] Difference in git merge order?

查看:417
本文介绍了git合并顺序的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  git merge c1 c2 

  git merge c2 c1 

?此外,是否有任何区别

  git checkout c1 
git合并c2

  git checkout c2 
git merge c1

解决方案

文件内容的最终结果应该与您描述的所有情况相同。



但是会有差异例如:



案例1: DAG 中,在所有提交图的提交顺序中, git merge c1 c2



  * dd24250(HEAD,master)合并分支'c1'和'c2 '
| \
| * 9d09bec(c2)在c2
* |中变化1f5c0ca(c1)在c1
| /



中的变化情况2: git merge c2 c1



  * 3256c8d(HEAD,master)合并分支'c2'和' c1'
| \
| * 1f5c0ca(c1)在c1
* |中更改9d09bec(c2)c2
| /



的变化情况3: git checkout c1; git merge c2



  * 111e7da(HEAD,c1)将分支'c2'合并到c1 
| \
| * 9d09bec(c2)在c2
* |中变化1f5c0ca在c1中的变化
| /



案例4: git checkout C2; git merge c1



  * 8ccf531(HEAD,c2)将分支'c1'合并到c2 
| \
| * 1f5c0ca(c1)在c1
* |中更改9d09bec在c2中变更
| /


Is there any difference between

git merge c1 c2

and

git merge c2 c1

? Also, is there any difference between

git checkout c1
git merge c2

and

git checkout c2
git merge c1

?

解决方案

The end result in terms of the file content should be the same in all cases you described.

But there will be a difference in the DAG, in the ordering of commits in the graph of all commits, for example:

Case 1: git merge c1 c2

*   dd24250 (HEAD, master) Merge branches 'c1' and 'c2'
|\  
| * 9d09bec (c2) change in c2
* | 1f5c0ca (c1) change in c1
|/  

Case 2: git merge c2 c1

*   3256c8d (HEAD, master) Merge branches 'c2' and 'c1'
|\  
| * 1f5c0ca (c1) change in c1
* | 9d09bec (c2) change in c2
|/  

Case 3: git checkout c1; git merge c2

*   111e7da (HEAD, c1) Merge branch 'c2' into c1
|\  
| * 9d09bec (c2) change in c2
* | 1f5c0ca change in c1
|/  

Case 4: git checkout c2; git merge c1

*   8ccf531 (HEAD, c2) Merge branch 'c1' into c2
|\  
| * 1f5c0ca (c1) change in c1
* | 9d09bec change in c2
|/  

这篇关于git合并顺序的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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