博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
What's the difference between 'git merge' and 'git rebase'?
阅读量:6566 次
发布时间:2019-06-24

本文共 865 字,大约阅读时间需要 2 分钟。

  hot3.png

Suppose originally there were 3 commits, A,B,C:

A-B-C

Then developer Dan created commit D, and developer Ed created commit E:

A-B-C-D-E

Obviously, this conflict should be resolved somehow. For this, there are 2 ways:

MERGE:

A-B-C-D-E-M

Both commits D and E are still here, but we create merge commit M that inherits changes from both D and E. However, this creates diamond shape, which many people find very confusing.

REBASE:

A-B-C-D-E-R

We create commit R, which actual file content is identical to that of merge commit M above. But, we get rid of commit E, like it never existed (denoted by dots - vanishing line). Because of this obliteration, E should be local to developer Ed and should have never been pushed to any other repository. Advantage of rebase is that diamond shape is avoided, and history stays nice straight line - most developers love that!

转载于:https://my.oschina.net/mskk/blog/2253602

你可能感兴趣的文章
检查IP是否可用的方法
查看>>
BFC的一些探究
查看>>
pt,px,rem和em之间区别总结
查看>>
互联网架构师必备技术 Docker仓库与Java应用服务动态发布那些事
查看>>
Intellij IDEA 2018.2 搭建Spring Boot 应用
查看>>
作为数据科学家,我都有哪些弱点
查看>>
(转)线程安全的CopyOnWriteArrayList介绍
查看>>
中交兴路完成7亿元A轮融资,携手蚂蚁金服共建小微物流科技服务生态
查看>>
对LinqtoExcel的扩展 【数据有限性,逻辑有效性】
查看>>
WPF TreeView HierarchicalDataTemplate
查看>>
32岁老程序员的现状和尴尬,无奈中透露些许悲凉,有选择却更痛苦
查看>>
WPF MeshGeometry3D
查看>>
puppet cron 模块
查看>>
pring-boot集成Springfox-Swagger2
查看>>
55、组播配置实验之PIM Sparse Mode静态指定RP
查看>>
Active Directory 对象授权还原
查看>>
WYSE *.ini常用写法以及ConfGen工具
查看>>
实例分析mysql用户登录
查看>>
CCNP听课笔记7
查看>>
Qt4连接mysql5数据库
查看>>