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. scp采用无密码在两台linux服务器之间传输数据

    一.root用户: 1. 在主机A上执行如下命令来生成配对密钥: ssh-keygen -t rsa 按照提示操作,注意,不要输入passphrase.提示信息如下 Generating public ...

  2. EF应用一:Code First模式

    EF的核心程序集位于System.Data.Entity.dll和System.Data.EntityFramework.dll中.支持CodeFirst的位于EntityFramework.dll中 ...

  3. 115个Java面试题和答案(下)

    转自:http://www.importnew.com/11028.html   第一篇讨论了面向对象编程和它的特点,关于Java和它的功能的常见问题,Java的集合类,垃圾收集器,本章主要讨论异常处 ...

  4. 【BZOJ】1050: [HAOI2006]旅行comf(暴力+并查集)

    http://www.lydsy.com/JudgeOnline/problem.php?id=1050 表示被暴力吓到了orz 我竟然想不到...我竟然还想到分数规划,,但是不可做...然后又想到最 ...

  5. 【BZOJ】1679: [Usaco2005 Jan]Moo Volume 牛的呼声(数学)

    http://www.lydsy.com/JudgeOnline/problem.php?id=1679 水题没啥好说的..自己用笔画画就懂了 将点排序,然后每一次的点到后边点的声音距离和==(n-i ...

  6. 【剑指offer】翻转单词顺序

    转载请注明出处:http://blog.csdn.net/ns_code/article/details/27372033 题目描写叙述: JOBDU近期来了一个新员工Fish,每天早晨总是会拿着一本 ...

  7. java中main方法的 (String []args)

    java中main方法的 (String []args)         String[] args是main函数的形式参数,可以用来获取命令行用户输入进去的参数.java 本身不存在不带String ...

  8. 《Linux实验要求》

    实验 1:登录和使用基本的 Linux 命令 实验环境: 安装了 Red Hat Enterprise Linux 6.0 可运行系统,并且是成功验证系统. 有另外一个无特权用户 student,密码 ...

  9. AngularJS------各种版本下载地址

    转载: http://blog.csdn.net/Rongbo_J/article/details/51325606 下载地址: github https://github.com/angular/a ...

  10. webpack 报错 path is not defind

    webpack.config.js里的内容是这样的,注意标红的地方: 首先,绝对路径'./dist'是 没有问题的 那么,查了很多,最后看到别人的webpack.config.js里面这样写着,现在c ...