git fetch pull checkout区别
1. git fetch:相当于是从远程获取最新版本到本地,不会自动merge
<p style="margin-top: 0px; margin-bottom: 10px; padding-top: 0px; padding-bottom: 0px;"><span style="line-height: 19px; font-family: 'Trebuchet MS', Tahoma, Arial; font-size: 13px;"><span class="pln" style="line-height: 23px; color: rgb(0, 0, 0);"> </span></span><br style="line-height: 23px;" /><span class="pln" style="line-height: 23px; color: rgb(0, 0, 0);">git fetch origin master</span><br style="line-height: 23px;" /><span class="pln" style="line-height: 23px; color: rgb(0, 0, 0);">git log </span><span class="pun" style="line-height: 23px; color: rgb(102, 102, 0);">-</span><span class="pln" style="line-height: 23px; color: rgb(0, 0, 0);">p master</span><span class="pun" style="line-height: 23px; color: rgb(102, 102, 0);">..</span><span class="pln" style="line-height: 23px; color: rgb(0, 0, 0);">origin</span><span class="pun" style="line-height: 23px; color: rgb(102, 102, 0);">/</span><span class="pln" style="line-height: 23px; color: rgb(0, 0, 0);">master</span><br style="line-height: 23px;" /><span class="pln" style="line-height: 23px; color: rgb(0, 0, 0);">git merge origin</span><span class="pun" style="line-height: 23px; color: rgb(102, 102, 0);">/</span><span class="pln" style="line-height: 23px; color: rgb(0, 0, 0);">master</span></p>
以上命令的含义:
首先从远程的origin的master主分支下载最新的版本到origin/master分支上
然后比较本地的master分支和origin/master分支的差别
最后进行合并
上述过程其实可以用以下更清晰的方式来进行:
<p style="margin-top: 0px; margin-bottom: 10px; padding-top: 0px; padding-bottom: 0px;"><span style="font-family: 'Trebuchet MS', Tahoma, Arial; font-size: 12px; line-height: 23px;"><span style="line-height: 19px;"><span class="pln" style="line-height: 23px; color: rgb(0, 0, 0);">git fetch origin master</span><span class="pun" style="line-height: 23px; color: rgb(102, 102, 0);">:</span><span class="pln" style="line-height: 23px; color: rgb(0, 0, 0);">tmp</span></span></span>
<span style="font-family: 'Trebuchet MS', Tahoma, Arial; font-size: 12px; line-height: 23px;"><span style="line-height: 19px;"><span class="pln" style="line-height: 23px; color: rgb(0, 0, 0);">git diff tmp </span></span></span>
<span style="font-family: 'Trebuchet MS', Tahoma, Arial; font-size: 12px; line-height: 23px;"><span style="line-height: 19px;"><span class="pln" style="line-height: 23px; color: rgb(0, 0, 0);">git merge tmp</span></span></span></p>
从远程获取最新的版本到本地的test分支上
之后再进行比较合并
2. git pull:相当于是从远程获取最新版本并merge到本地
<p style="line-height: 23px; margin-top: 0px; margin-bottom: 10px; padding-top: 0px; padding-bottom: 0px;"><span class="pln" style="color: rgb(0, 0, 0);">git pull origin master</span></p>
上述命令其实相当于git fetch 和 git merge
在实际使用中,git fetch更安全一些
因为在merge前,我们可以查看更新情况,然后再决定是否合并
git fetch pull checkout区别的更多相关文章
- Git fetch & pull 区别
1 简单概括 2 git fetch 的用法 3 git pull的用法 文章来源:https://blog.csdn.net/qq_36113598/article/details/78906882
- Git fetch & pull
转:https://blog.csdn.net/qq_36113598/article/details/78906882 1.简单概括 先用一张图来理一下git fetch和git pull的概念: ...
- git fetch & pull详解
1.简单概括 先用一张图来理一下git fetch和git pull的概念: 可以简单的概括为: git fetch是将远程主机的最新内容拉到本地,用户在检查了以后决定是否合并到工作本机分支中. 而g ...
- Git 协作:Fetch Pull Push Branch Remote Rebase Cherry-pick相关
前言 学习git的时候,我们首先学习的是最常用的,自己独立开发Software时用的命令: git init //初始化git仓库 git add <file_name> //将文件添加到 ...
- git fetch和git pull对比
情景重现 你:面试官您好,我是xxx,毕业于xxx学校,工作xxx年,精通各种git命令. 面试官:您好您好,我问个常见的问题考察一下您的技术水平哈.请问,git pull和git fetch有什么区 ...
- git:Git fetch和git pull的区别, 解决Git报错:error: You have not concluded your merge (MERGE_HEAD exists).
Git fetch和git pull的区别, 解决Git报错:error: You have not concluded your merge (MERGE_HEAD exists). 解决办法一:保 ...
- git fetch和git pull之间的区别--转载
原文地址:http://blog.csdn.net/a19881029/article/details/42245955 git fetch和git pull都可以用来更新本地库,它们之间有什么区别呢 ...
- GIT(6)----fork和clone的区别,fetch与pull的区别
参考资料: [1].Git学习笔记:fork和clone的区别,fetch与pull的区别 [2].在Github和Git上fork之简单指南
- git clone、git pull和git fetch的用法及区别
声明:码字不易,转载请注明出处,欢迎文章下方讨论交流.Git 常用命令速查表 最近在一个学习小组里学习AI的课程,我们所有的学习资料和homework都放在gitlab上.今天一个小队友从gitlab ...
随机推荐
- cuckoo数据库变更
1.cuckoo版本升级 cuckoo默认的数据库为sqlite,默认连接方式为sqlite:///os.path.join(REPORT_ROOT, "db", "cu ...
- 设置radio的选中状态
$("#s7").click(function () { var a = document.getElementById("s7"); if (a.checke ...
- /tmp 和 /var/tmp 的区别
/tmp is meant as fast (possibly small) storage with a short time to live (TTL). Many systems clean / ...
- 部署WEB应用的三种方式[转]
一.基本部署 Tomcat安装目录下有一个webapps目录,该目录存放所有的WEB应用程序,Tomcat会自动管理该目录下的所有WEB应用.因此,最简单的部署方式就是将要部署的WEB应用直接拷贝到T ...
- WEB前端组件思想【分页】
DEMO1: 很早就想写一些功能性的组件,无奈技术有限一点一点的边工作,边学. 近日工作中用到分页功能,当然由于加快业务进度,第一选择肯定是选择插件,但是实用性来说,还是有那么一点不适合.毕竟插件是通 ...
- Jquery获得 selection的text 和 option值
Jquery获得 selection的text 和 option值 <select id="accountStatus" editable="false" ...
- 图的存储结构:邻接矩阵(邻接表)&链式前向星
[概念]疏松图&稠密图: 疏松图指,点连接的边不多的图,反之(点连接的边多)则为稠密图. Tips:邻接矩阵与邻接表相比,疏松图多用邻接表,稠密图多用邻接矩阵. 邻接矩阵: 开一个二维数组gr ...
- setsockopt()用法(参数详细说明)(转)
nt setsockopt(SOCKET s,int level,int optname,const char* optval,int optlen); s(套接字): 指向一个打开的套接口描述字le ...
- static 控件颜色修改
在对话框上放一个StaticText控件后如果文字长度不能铺满控件的 rect,如下: 那么运行时会出现如下效果 通过MSG_WM_CTLCOLORSTATIC消息修改static控件背景色模式为透明 ...
- 第三次冲刺spring会议(第四次会议)
[例会时间]2014/5/23 21:15 [例会地点]9#446 [例会形式]轮流发言 [例会主持]马翔 [例会记录]兰梦 小组成员:兰梦 ,马翔,李金吉,赵天,胡佳奇