git pull --rebase的理解
在使用git的过程中经常需要使用到git pull命令,在更新远端代码的同时如果与本地代码产生冲突了,
那么冲突的文件中就出现了需要手动合并的部分,而git pull --rebase不同的地方则是当有这些冲突存在时,
git帮我们自动创建了一个新的分支,并且git告诉你接下来你要在这个新的分支上处理这个冲突,
此时执行git status命令后可以看到首要的提示是这样的:
rebase in progress; onto 24f42c6
You are currently rebasing branch 'master' on '24f42c6'.
(fix conflicts and then run "git rebase --continue")
并且git还告诉我们 fix conflicts and then run "git rebase --continue",意思是解决冲突然后执行git rebase --continue命令,
其实git rebase --continue的正确操作应该是确认处理好冲突后则将调整好的文件添加到暂存区,并执行git rebase --continue命令告诉git,我已经解决好冲突了,
并且已经将处理后的文件添加到了暂存区,现在可以将这些文件commit了,
简单来讲就是正常的解决冲突过程是
1,git add .
2,git commit -m "..."
3,git push时因为本地仓库代码与远程仓代码有冲突,所以接下来
4,git pull拉取远程代码,而冲突需要手动解决
5,解决好后重新进行git add . git commit -m".." git push
而git pull 这一步如果加上了 --rebase的选项,那么第5步操作将变成如下
git add .
git rebase --continue
git push
所以git pull --rebase用在合并代码的时候其作用就是在一个随机创建的分支上处理冲突,避免了直接污染原来的分区
git pull --rebase的理解的更多相关文章
- 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的使用
使用下面的关系区别这两个操作: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 pull --rebase的使用
原文:http://www.cnblogs.com/kevingrace/p/5896706.html 使用下面的关系区别这两个操作:git pull = git fetch + git mergeg ...
- git pull和git pull --rebase的使用
使用下面的关系区别这两个操作: git pull = git fetch + git merge git pull --rebase = git fetch + git rebase 现在来看看git ...
- 聊下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 ...
随机推荐
- 【ECNU71】一个游戏(水题)
点此看题面 大致题意: \(n\)种元素,有若干组将\(x\)元素转化为\(y\)元素的操作.问对于所有可能的元素拥有状况,改变转化操作的顺序,是否会影响转化后最终的结果. 水题 虽说是这么水的题,但 ...
- golang数据结构之树的三种遍历方式
tree.go package tree import ( "fmt" ) type TreeNode struct { ID int Val int Left *TreeNode ...
- Spring中注解方式实现IOC和AOP
1.IOC注解 1.1 IOC和DI的注解 IOC: @Component:实现Bean组件的定义 @Repository:用于标注DAO类,功能与@Component作用相当 @Service:用 ...
- 12306抢票带来的启示:看我如何用Go实现百万QPS的秒杀系统
本文为开源实验性工程:“github.com/GuoZhaoran/spikeSystem”的配套文章,原作者:“绘你一世倾城”,现为:猎豹移动php开发工程师,感谢原作者的技术分享. 1.引言 Go ...
- mysql Hash索引和BTree索引区别
Hash仅支持=.>.>=.<.<=.between.BTree可以支持like模糊查询 索引是帮助mysql获取数据的数据结构.最常见的索引是Btree索引和Hash索引. ...
- Think in Speed (关于速度的一点思考)
天下武功,无坚不摧,唯快不破!所以我们重视速度没毛病! 老话说:不要过早优化.赞同! 我们在写代码过程中,有时可能就是为了追求所谓的性能,然后,就给自己挖坑了. 关于开发速度,我有以下几点思考: 1. ...
- Requests库主要方法解析以及Requests库入门需要掌握的框架
Requests库主要方法解析以及Requests库入门 1.requests.request(method,url,**kwargs) **kwargs:控制访问的参数,均为可选项 params:字 ...
- python bin文件处理
参考: https://blog.csdn.net/and_then111/article/details/86744938 https://blog.csdn.net/zw515370851/art ...
- Java生鲜电商平台-API请求性能调优与性能监控
Java生鲜电商平台-API请求性能调优与性能监控 背景 在做性能分析时,API的执行时间是一个显著的指标,这里使用SpringBoot AOP的方式,通过对接口添加简单注解的方式来打印API的执行时 ...
- 易优CMS:小白学代码之notempty
[基础用法] 名称:notempty 功能:判断某个变量是否为空,可以嵌套到任何标签里面使用,比如:channel.type等 语法: {eyou:notempty name='$eyou.field ...