Git中从远程的分支获取最新的版本到本地有这样2个命令:
1. git fetch:相当于是从远程获取最新版本到本地,不会自动merge

Git fetch origin master
git log -p master..origin/master
git merge origin/master

以上命令的含义:
   首先从远程的origin的master主分支下载最新的版本到origin/master分支上
   然后比较本地的master分支和origin/master分支的差别
   最后进行合并

2. git pull:相当于是从远程获取最新版本并merge到本地

git pull origin master

上述命令其实相当于git fetch 和 git merge
  在实际使用中,git fetch更安全一些
  因为在merge前,我们可以查看更新情况,然后再决定是否合并。

git pull和git fetch的区别的更多相关文章

  1. git pull、git fetch、git merge、git rebase的区别

    一.git pull与git fetch区别 1.两者的区别       两者都是更新远程仓库代码到本地. git fetch相当于是从远程获取最新版本到本地,不会自动merge. 只是将远程仓库最新 ...

  2. git pull和git fetch命令

    git pull和git fetch命令 git pull git pull命令的作用是取回远程主机某个分支的更新,在与本地指定分支合并,格式如下: $ git pull <远程主机名>& ...

  3. git pull ,git fetch ,git merge

    git pull 是git fetch与git merge的组合. 有时候拆开使用,会更加的安全. 比如想比较,本地分支,与线上分支的差别,就可以先 git fetch 这样就可以,git diff ...

  4. git fetch 、git pull 与 git pull --rebase

    1. git fetch 与 git pull 都是从远程拉取代码到本地,git fetch只是拉取到本地,git pull不仅拉取到本地还merge到本地分支中.所以git pull是git fet ...

  5. 差异:git clone , git fetch, git pull和git rebase

    随笔 - 96  文章 - 1  评论 - 6   Git Pull据我所知,当你使用git pull时,它将会获取远程服务器(你请求的,无论什么分支)上的代码,并且立即合并到你的本地厂库,Pull是 ...

  6. Difference between git pull and git pull --rebase

    个人博客地址:  http://www.iwangzheng.com/ 推荐一本非常好的书 :<Pro Git>  http://iissnan.com/progit/ 构造干净的 Git ...

  7. 对比git pull和git pull --rebase

    1.使用下面的关系区别这两个操作:git pull = git fetch + git mergegit pull --rebase = git fetch + git rebase 2 一.基本 g ...

  8. 简单对比git pull和git pull --rebase的使用

    使用下面的关系区别这两个操作:git pull = git fetch + git mergegit pull --rebase = git fetch + git rebase 现在来看看git m ...

  9. 【Git】git pull和git pull --rebase的使用

    git pull = git fetch + git mergegit pull --rebase = git fetch + git rebase 现在来看看git merge和git rebase ...

  10. git pull和git pull --rebase的使用

    使用下面的关系区别这两个操作: git pull = git fetch + git merge git pull --rebase = git fetch + git rebase 现在来看看git ...

随机推荐

  1. CSS3:RGBA的使用方法

    1.说明 此色彩模式与RGB相同,只是在RGB模式上新增了Alpha透明度. RGBA(R,G,B,A) 2.取值 R: 红色值,正整数值的取值范围为:0 - 255,百分数值的取值范围为:0.0% ...

  2. Unity中使用Attribute

    Attribute是c#的语言特性 msdn说明如下: The Attribute class associates predefined system information or user-def ...

  3. Redux状态管理方法与实例

    状态管理是目前构建单页应用中不可或缺的一环,也是值得花时间学习的知识点.React官方推荐我们使用Redux来管理我们的React应用,同时也提供了Redux的文档来供我们学习,中文版地址为http: ...

  4. 平常看到的Alt+xx 快捷键用法

    1. 先按Alt, 哪一个菜单对应的字符是有划线的. 2. 输入对应的字符打开相应的菜单, 3 再输入相应的字符打开子菜单

  5. [LeetCode] Intersection of Two Arrays II 两个数组相交之二

    Given two arrays, write a function to compute their intersection. Example:Given nums1 = [1, 2, 2, 1] ...

  6. [LeetCode] Inorder Successor in BST 二叉搜索树中的中序后继节点

    Given a binary search tree and a node in it, find the in-order successor of that node in the BST. No ...

  7. [LeetCode] Add and Search Word - Data structure design 添加和查找单词-数据结构设计

    Design a data structure that supports the following two operations: void addWord(word) bool search(w ...

  8. [EF2]Sneak Preview: Persistence Ignorance and POCO in Entity Framework 4.0

    http://blogs.msdn.com/b/adonet/archive/2009/05/11/sneak-preview-persistence-ignorance-and-poco-in-en ...

  9. Ubuntu上基于开源代码PhoneMe的J2ME环境搭建及使用

    测试环境:Ubuntu 14.04.5 LTS J2ME背景知识及PhoneME介绍 J2ME相关介绍 在正式开始介绍J2ME之前,这里我列出一些常见名词,方便与下文参照:J2ME(Java2 Pla ...

  10. IOS跑马灯效果,实现文字水平无间断滚动

    ViewController.h #import <UIKit/UIKit.h> @interface ViewController : UIViewController{ NSTimer ...