git pull --rebase的使用
原文:http://www.cnblogs.com/kevingrace/p/5896706.html
使用下面的关系区别这两个操作:
git pull = git fetch + git merge
git pull --rebase = git fetch + git rebase
现在来看看git merge和git rebase的区别。
假设有3次提交A,B,C。
在远程分支origin的基础上创建一个名为"mywork"的分支并提交了,同时有其他人在"origin"上做了一些修改并提交了。
其实这个时候E不应该提交,因为提交后会发生冲突。如何解决这些冲突呢?有以下两种方法:
1、git merge
用git pull命令把"origin"分支上的修改pull下来与本地提交合并(merge)成版本M,但这样会形成图中的菱形,让人很困惑。
2、git rebase
创建一个新的提交R,R的文件内容和上面M的一样,但我们将E提交废除,当它不存在(图中用虚线表示)。由于这种删除,小李不应该push其他的repository.rebase的好处是避免了菱形的产生,保持提交曲线为直线,让大家易于理解。
在rebase的过程中,有时也会有conflict,这时Git会停止rebase并让用户去解决冲突,解决完冲突后,用git add命令去更新这些内容,然后不用执行git-commit,直接执行git rebase --continue,这样git会继续apply余下的补丁。
在任何时候,都可以用git rebase --abort参数来终止rebase的行动,并且mywork分支会回到rebase开始前的状态。
git pull --rebase的使用的更多相关文章
- 聊下git pull --rebase
有一种场景是经常发生的. 大家都基于develop拉出分支进行并行开发,这里的分支可能是多到数十个.然后彼此在进行自己的逻辑编写,时间可能需要几天或者几周.在这期间你可能需要时不时的需要pull下远程 ...
- 关于git中git pull --rebase中的一些坑
在公司里面,每次我更改完代码,准备pull最新代码时,总是会遇到各种各样的问题.,因为对应的问题不同,解决方法很多.但是比较通用的办法还是有的: git pull --rebase //报错时 g ...
- git pull --rebase
git reset --hard orgin/master $ git push bit 1.8-subchannels To git@bitbucket.org:cms.git ! [rejecte ...
- Difference between git pull and git pull --rebase
个人博客地址: http://www.iwangzheng.com/ 推荐一本非常好的书 :<Pro Git> http://iissnan.com/progit/ 构造干净的 Git ...
- git pull --rebase 做了什么? 以及 Cannot rebase: You have unstaged changes 解决办法
最近刚学 git rebase,觉得很牛逼的样子, 结果今天就被打脸了. git pull --rebase 报错: Cannot rebase: You have unstaged changes ...
- 对比git pull和git pull --rebase
1.使用下面的关系区别这两个操作:git pull = git fetch + git mergegit pull --rebase = git fetch + git rebase 2 一.基本 g ...
- git pull以及git pull --rebase
git pull的作用是将远程库中的更改代码合并到当前分支中,默认为:git fetch + git merge git fetch 的作用就相当于是从远程库中获取最新版本到本地分支,不会自动进行gi ...
- 简单对比git pull和git pull --rebase的使用
使用下面的关系区别这两个操作:git pull = git fetch + git mergegit pull --rebase = git fetch + git rebase 现在来看看git m ...
- 【Git】git pull和git pull --rebase的使用
git pull = git fetch + git mergegit pull --rebase = git fetch + git rebase 现在来看看git merge和git rebase ...
- git fetch 、git pull 与 git pull --rebase
1. git fetch 与 git pull 都是从远程拉取代码到本地,git fetch只是拉取到本地,git pull不仅拉取到本地还merge到本地分支中.所以git pull是git fet ...
随机推荐
- ProcessHelp 进程类(启动,杀掉,查找)
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using S ...
- XSS 与 CSRF 两种跨站攻击
在前几年,大家一般用拼接字符串的方式来构造动态 SQL 语句创建应用,于是 SQL 注入成了很流行的攻击方式, 但是现在参数化查询 已经成了普遍用法,我们已经离 SQL 注入很远了.但是历史同样悠久的 ...
- 黄聪:sqlserver 2008修改数据库表的时候错误提示“阻止保存要求重新创建表的更改”
当用户在在SQL Server 2008企业管理器中更改表结构时,必须要先删除原来的表, 然后重新创建新表,才能完成表的更改,如果强行更改会出现以下提示:不允许保存更改 .您所做的更改要求删除并重新创 ...
- NPOI-Excel系列-1002.创建带有Document Summary Information和Summary Information的Excel文件
1. using NPOI.HSSF.UserModel; using NPOI.HPSF; using NPOI.POIFS.FileSystem; using Microsoft.VisualSt ...
- SQL 知识及用法备忘录
---查询当前数据库一共有多少张表 ) from sysobjects where xtype='U' ---查询当前数据库有多少张视图 ) from sysobjects where xtype=' ...
- HDU 1710 Binary Tree Traversals(树的建立,前序中序后序)
Binary Tree Traversals Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/O ...
- 需登录账号与密码的网页爬取demo
public static String connect(String dataUrl){ String result = null; try { HttpClient httpclient = ne ...
- Oracle11g 搭建单实例DataGuard (转载)
原文:http://blog.itpub.net/29324876/viewspace-1246133/ 环境:主备库都为单实例并且数据库SID相同 OS:red hat 6.5 Oracle:11. ...
- python 构造mysql爆破器
前言: 今天已经期末考完,睡了个觉起床写了个 mysql爆破器. 思路: 1.爆破用户->用户存在的话不会报错反之报错 2.爆破密码->密码正确不会报错反之报错 3.用户名和密码一起爆破- ...
- Pthreads 信号量,路障,条件变量
▶ 使用信号量来进行线程间信息传递 ● 代码 #include <stdio.h> #include <pthread.h> #include <semaphore.h& ...