博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
git rebase vs git merge
阅读量:6823 次
发布时间:2019-06-26

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

hot3.png

语法为git rebase [base], base就是commit id或者ref名称

比如git fetch; git rebase origin/master
就是将自己自clone或上次pull以来所有的自己所做的的commit(尚未push的)放在[base]之后,让commit history看起来是线性的。
以下是精华部分:

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

A-B-C

Then developer Dan created commitD, and developer Ed created commitE:

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 commitsDandEare still here, but we create merge commitMthat inherits changes from bothDandE. However, this creates diamond shape, which many people find very confusing.

REBASE:

A-B-C-D-E-R

We create commitR, which actual file content is identical to that of merge commitMabove. But, we get rid of commitE, like it never existed (denoted by dots - vanishing line). Because of this obliteration,Eshould 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!

详细的解释挨个读:

http://stackoverflow.com/questions/16666089/whats-the-difference-between-git-merge-and-git-rebase

http://stackoverflow.com/questions/16336014/git-merge-vs-rebase

http://segmentfault.com/q/1010000000430041

http://linux.cn/article-4046-1.html

http://gitbook.liuhui998.com/4_2.html

https://benmarshall.me/git-rebase/

https://help.github.com/articles/using-git-rebase/

转载于:https://my.oschina.net/uniquejava/blog/496434

你可能感兴趣的文章
linux文件的三个主要的修改时间
查看>>
加快SCVMM虚拟机部署
查看>>
构建基于GFS文件系统的RHCS架构集群
查看>>
ASP.NET FORM验证
查看>>
网络布线跨度过长导致信号延迟问题的解决方法
查看>>
系统安全之iptables防火墙
查看>>
WSUS3.0部署与AD下补丁分发及解决卸载出错问题
查看>>
Spring中Bean的生命周期
查看>>
LiveMigration之三配置高可用群集
查看>>
【自定义Android带图片和文字的ImageButton】
查看>>
winfrom让弹出的MessageBox在指定时间内自动销毁
查看>>
向列表群发邮件时,发件人中带有收件人所在的列表名称
查看>>
活动目录迁移需要的步骤
查看>>
python list循环remove操作的神奇问题
查看>>
网路游侠:稳捷网络BeSecure WEB安全网关试用
查看>>
Windows phone 应用开发[8]-体验PhoneGap
查看>>
浅谈Excel中的“合并单元格”
查看>>
akka actors默认邮箱介绍
查看>>
CentOS 网络基础:(1)HostName和DNS
查看>>
AIX系统学习之--卸载软件错误
查看>>