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 ...
随机推荐
- php 微信 统一下单 接口实例
<?phpclass wechatAppPay { //接口API URL前缀 const API_URL_PREFIX = 'https://api.mch.weixin.qq.com'; / ...
- FileZilla客户端源码解析
FileZilla客户端源码解析 FTP是TCP/IP协议组的协议,有指令通路和数据通路两条通道.一般来说,FTP标准命令TCP端口号是21,Port方式数据传输端口是20. FileZilla作为p ...
- C# WebBrowser禁止F5刷新
在用写一个桌面软件的过程中,用到webbrowser实现界面.这时有一个禁止webbrowser通过f5按键进行刷新的要求.本着边做边学的原则,本菜查了一下百度,原来这么简单,代码如下: this.w ...
- ZZNU 1163: 在线判题(指针专题)
题目描述 Ignatius is building an Online Judge, now he has worked out all the problems except the Judge S ...
- Oracle 四种列转行的方法
1. Oracle自带列转行函数listagg: 实例: with temp as( select 'China' nation ,'Guangzhou' city from dual union a ...
- vs2008试用版的评估期已经结束解决办法
1.控制面板----程序和功能----找到VS2008,打开"卸载/更改". 2.下载补丁:files.cnblogs.com/elaky/PatchVS2008.zip 打补丁之 ...
- heap和stack的区别
参考<程序员面试宝典> 1.栈区(stack) 由编译器自动分配和释放,存放函数的参数值,局部变量值等.其操作方式类似于数据中的栈. 2.堆区(heap) 一般由程序员分配和释放,若程序员 ...
- Java comparable 和 comparator
一.comparator 接口继承 public class ComparatorTest { /** * @param args */ public static void main(String[ ...
- Lua手册中的string.len 不解
Lua手册中的string.len (s) 接收一个字符串,返回其长度. 空串 "" 的长度为 0 . 内嵌零也统计在内,因此 "a\000bc\000" 的长 ...
- Windows文件监视器 1.0 绿色版
软件名称:软件名称: Windows文件监视器 软件语言: 简体中文 授权方式: 免费软件 运行环境: Win7 / Vista / Win2003 / WinXP / Win2008 软件大小: 1 ...