From:http://www.tech126.com/git-fetch-pull/

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分支的差别;
   最后,进行合并。

上述过程其实可以用以下更清晰的方式来进行:

git fetch origin master:tmp
git diff tmp
git merge tmp

从远程获取最新的版本到本地的test分支上;
   之后再进行比较合并。

2. git fetch更新版本库镜像

git fetch的另一个用法是将镜像版本库对应的远程版本库的更新同步到镜像版本库。

在xxx.git镜像版本库目录下,执行git fetch,即可将远程版本库的更新同步到本地镜像。

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

git pull origin master

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

git fetch和git pull(转载)的更多相关文章

  1. git fetch和git pull之间的区别--转载

    原文地址:http://blog.csdn.net/a19881029/article/details/42245955 git fetch和git pull都可以用来更新本地库,它们之间有什么区别呢 ...

  2. Git fetch和git pull的区别

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

  3. Git fetch和git pull的区别(转)

    原文: http://www.tech126.com/git-fetch-pull/ Git中从远程的分支获取最新的版本到本地有这样2个命令:1. git fetch:相当于是从远程获取最新版本到本地 ...

  4. 关于git fetch 和git pull 的区别

    1.fetch 相当于是从远程获取最新版本呢到本地,不会自动merge. git fetch origin master:tmpgit diff tmp git merge tmp 2. git pu ...

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

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

  6. git fetch , git pull

    要讲清楚git fetch,git pull,必须要附加讲清楚git remote,git merge .远程repo, branch . commit-id 以及 FETCH_HEAD. 1. [g ...

  7. git fetch and git pull &冲突

    1.git fetch和git pull之间的区别 git fetch只会将本地库所关联的远程库的commit id更新至最新,fetch不会改变代码,如果想使代码更新,需要使用git merge o ...

  8. [Git] Git fetch和git pull的区别

    reference : http://blog.csdn.net/hudashi/article/details/7664457 Git中从远程的分支获取最新的版本到本地有这样2个命令:1. git ...

  9. git fetch 和 git pull 的区别

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

随机推荐

  1. Hightchart.js 的使用

    中文网址介绍 http://www.hcharts.cn/docs/basic-zoom http://v1.hcharts.cn/demo/index.php?p=46

  2. HttpWebRequest's Timeout and ReadWriteTimeout — What do these mean for the underlying TCP connection?

    http://stackoverflow.com/questions/7250983/httpwebrequests-timeout-and-readwritetimeout-what-do-thes ...

  3. php特殊语法--模板引擎中比较常见

    <?php $a=array(1,2,0); foreach ($a as $v): if($v>1): ?> 5 <?php endif; endforeach; ?> ...

  4. 利用KMeans聚类进行航空公司客户价值分析

    准确的客户分类的结果是企业优化营销资源的重要依据,本文利用了航空公司的部分数据,利用Kmeans聚类方法,对航空公司的客户进行了分类,来识别出不同的客户群体,从来发现有用的客户,从而对不同价值的客户类 ...

  5. HTTP 错误 500.19 - Internal Server Error 无法访问请求的页面,因为该页的相关配置数据无效。

    HTTP 错误 500.19 - Internal Server Error 无法访问请求的页面,因为该页的相关配置数据无效. 详细错误信息模块 IIS Web Core 通知 BeginReques ...

  6. 导出多级表头表格到Excel

    方法一:用NPOI定义多级表头导出: 引用头: using NPOI.DDF; using NPOI.OpenXmlFormats.Wordprocessing; using NPOI.HSSF.Us ...

  7. windows 2003 server 远程桌面禁用本地资源,磁盘驱动器,串行口,复制文件

    首先进入组策略编辑器(开始-运行-gpedit.msc) 不要让用户在远端桌面和本地直接拷贝文件在远端桌面上进入它的组策略编辑器在 计算机配置->管理模板->Windows组件->终 ...

  8. Android禁止横屏竖屏切换

    在Android中要让一个程序的界面始终保持一个方向,不随手机方向转动而变化的办法: 只要在AndroidManifest.xml里面配置一下就可以了. 在AndroidManifest.xml的ac ...

  9. Python 从sketch中读取文件

    =============================== RESTART: Shell =============================== >>> import o ...

  10. MIT牛人解说数学体系(转载)

    原文网址:http://www.guokr.com/post/442622/ 在过去的一年中,我一直在数学的海洋中游荡,research进展不多,对于数学世界的阅历算是有了一些长进. 为什么要深入数学 ...