1.pull = fetch + merge

In the simplest terms, git pull does a git fetch followed by a git merge.

You can do a git fetch at any time to update your remote-tracking branches under refs/remotes/<remote>/. This operation never

changes any of your own local branches under refs/heads, and is safe to do without changing your working copy.  I have even heard

of people running git fetch periodically in a cron job in the background (although I wouldn't recommend doing this).

git pull is what you would do to bring a local branch up-to-date with its remote version, while also updating your other

remote-tracking branches.

2. merge VS rebase

2.1、merge命令

把origin分支上的修改拉下来并且和你的修改合并;产生一个合并的提交(merge commit):

2.2、rebase命令

把你的分支里的每个提交(commit)取消掉,并且把它们临时保存为补丁(patch)(.git/rebase目录),然后把你的分支更新到最新的origin分支,

最后把保存的这些补丁应用到你的分支上。在rebase的过程中,也许会出现冲突(conflict),Git会停止rebase并会让你去解决 冲突;在解决完冲突后,

用"git-add"命令去更新这些内容的索引(index), 然后,你无需执行 git-commit,只要执行:

$ git rebase --continue

这样git会继续应用(apply)余下的补丁。在任何时候,你可以用--abort参数来终止rebase的行动,你的分支会回到rebase开始前的状态。

$ git rebase --abort

3. git merge VS git merge --no-ff

git merge 在没有冲突的时候不会生成新的commit。

如果想在没有冲突的情况下也自动生成一个commit,记录此次合并就可以用:git merge --no-ff命令。

git 的 pull、fetch、merge的更多相关文章

  1. Git之pull,fetch差别

    简言之, pull=fetch+merge,下拉远程分支并与本地分支合并. fetch只是下拉远程分支,怎么合并,可以自己再做选择. 进一步了解是,git本地有暂存区(亦称为Index区) fetch ...

  2. [eclipse中使用Git插件] 008 - git操作pull、merge、stash、commit

    写在前面: 看标题其实还有001-007之类,本来准备写详细的类似教程一样的东东,但是懒了且时间有限(以后或许会补吧),所以跳到008,录下主要的操作. 所以本随笔的重点就是[pull+merge+s ...

  3. Git CMD - pull: Fetch from and integrate with another repository or a local branch

    命令格式 git pull [options] [<repository> [<refspec>…​]] 命令参数 -q, --quiet 安静模式. -v, --verbos ...

  4. git fetch, merge, pull, push需要注意的地方(转)

    在git操作中,我们经常会用到fetch, merge, pull和push等命令,以下是一些我们需要注意的地方. 给大家准备了参考资料: 1. Whatʼs a Fast Forward Merge ...

  5. git fetch, merge, pull, push需要注意的地方

    在git操作中,我们经常会用到fetch, merge, pull和push等命令,以下是一些我们需要注意的地方. 给大家准备了参考资料: 1. Whatʼs a Fast Forward Merge ...

  6. 第27月第24天 git pull fetch

    1. 在进行 pull 操作的同时,其实就是 fetch+merge 的一个过程.我们从 remote 分支中拉取新的更新,然后再合并到本地分支中去. 如果 remote 分支超前于本地分支,并且本地 ...

  7. git无法pull仓库refusing to merge unrelated histories (拒绝合并不相关仓库)

    原文地址 https://blog.csdn.net/lindexi_gd/article/details/52554159 本文讲的是把git在最新2.9.2,合并pull两个不同的项目,出现的问题 ...

  8. Git:pull --rebase 和 merge --no-ff

    首先是吐嘈 如果你正在 code review,看到上图(下文将称之为:提交线图)之后,特别是像我这样有某种洁癖的人,是否感觉特别难受?如果是的话,请看下文吧 :) 为什么 Git 作为分布式版本控制 ...

  9. Git 一次性 pull push 所有的分支

    /********************************************************************************* * Git 一次性 pull pu ...

随机推荐

  1. rsync详解之exclude排除文件

    rsync详解之exclude排除文件 问题:如何避开同步指定的文件夹?  --excludersync  --exclude files and folders http://articles.sl ...

  2. ASP.NET MVC4 权限验证

    在ASP.NET MVC4 中继承ActionFilterAttribute 类,重写OnActionExecuting方法 /// <summary> /// 权限拦截 /// < ...

  3. Unity基于DFGUI的TreeView设计

    using UnityEngine; using System.Collections; public class Item { public string Id; public string Nam ...

  4. 【noip模拟题】日历游戏(博弈论+搜索)

    直接搜索即可... 注意不要爆栈..所以我们可以分块搜索... 然后太懒且太弱我就不写了... orz hzwer http://hzwer.com/4954.html [问题描述] moreD和mo ...

  5. FormData异步上传

    1.代码片段一: ajaxUpload: function () { var url = this.$avatarForm.attr('action'), data = new FormData(th ...

  6. JQuery获取和设置select下拉框的值

    获取Select : 获取select 选中的 text : $("#sid").find("option:selected").text(); 获取selec ...

  7. PHP常用技术文之文件操作和目录操作总结

    <?php header("content-type:text/html;charset=utf-8"); /* *声明一个函数,传入文件名获取文件属性 *@param st ...

  8. hdu 1232:畅通工程(数据结构,树,并查集)

    畅通工程 Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submis ...

  9. [转]Shell脚本中发送html邮件的方法

    <span "="">作为运维人员,免不了要编写一些监控脚本,并将监控结果及时的发送出来.那么通过邮件发送是比较常用的一种通知方式了.通常的,如果需要发送的内 ...

  10. c# word excel 二进制 存入数据库

    在Sql Server中存储.读写Word文件,需要将指定表字段添加为Image类型,示例表结构为:1 CREATE TABLE CONTRACTS ( 2 ID VARCHAR (50), 3 CO ...