http://blog.csdn.net/hansel/article/details/8952967

使用".."(两个点)和"..."(三个点)都可以指定一段git提交范围,它们有什么区别呢?

1.如果是在git log命令中

man git-rev-list可以知道它们的区别。

“r1..r2" 与 "^r1 r2"表示的范围一样,都是可以到达r2但不可以到达r1的所有提交。

如下图的提交历史:

git log F..J 将显示C, G, H, I, J

git log J..F 将显示D, E, F

git log F..M 将显示K, L, M

git log M..F 将显示B, D, E, F

  1. D---E-------F
  2. /
  3. B---C---G---H---I---J
  4. /
  5. A-------K---------------L--M

“r1...r2"叫做”symmetric difference“,它与 "r1 r2 --not $(git merge-base --all r1 r2)"表示的范围一样,都是表示可以到r1或者r1,但是不能同时达到两者的提交。

“r1...r2" 与 “r2...r1"表示的是一样的。

还是如上图的git提交历史:

git log F...J 将显示D, E, F, C, G, H, I, J

git log F...M 将显示B, D, E, F, K, L, M

2. 如果是在git diff命令中

参考man git-diff的说明。"r1..r2"表示r1到r2之间的区别,而"r1...r2"表示从r1和r2公共祖先到r2的区别。

  git diff [--options] <commit> <commit> [--] [<path>...]
              This is to view the changes between two arbitrary <commit>.   git diff [--options] <commit>..<commit> [--] [<path>...]
              This is synonymous to the previous form. If <commit> on one side is omitted, it will have the same
              effect as using HEAD instead. git diff [--options] <commit>...<commit> [--] [<path>...] This form is to view the changes on the branch containing and up to
the second <commit>, starting at a common ancestor of both
<commit>. "git diff A...B" is equivalent to "git diff
$(git-merge-base A B) B". You can omit any one of <commit>, which
has the same effect as using HEAD instead.               $ git diff topic master    (1)
              $ git diff topic..master   (2)
              $ git diff topic...master  (3)               1. Changes between the tips of the topic and the master branches.
              2. Same as above.
              3. Changes that occurred on the master branch since when the topic branch was started off it.

 

使用".."指定git提交范围与"..."指定git提交范围的区别的更多相关文章

  1. git命令行clone指定分支、更新、冲突解决、提交代码步骤

    clone指定分支 : git init 初始化仓库 git clone -b 分支名  git@192.168.3.166:xxxx/xxxx.git   克隆指定分支 更新 :git status ...

  2. GIT 如何合并另一个远程Git仓库的文件到本地仓库里某个指定子文件夹并不丢失远程提交记录?

    问题背景:     最近在重新整理手中的一个项目,目前该项目分为PC项目,手机项目,某第三方接口项目,第三方接口服务项目和手机项目     因为之前规划的原因,原来的四个项目是分两个解决方案来管理的 ...

  3. git提交时忽略指定文件

    git提交时忽略指定文件 我们在项目开发过程中经常用到git来管理自己的项目,使用git版本控制进行多人协作开发具有许多优势,这里就不一一阐述了,有兴趣的同学可以自己去查找资料进行系统的学习.而本篇文 ...

  4. git 操作 :从远程仓库gitLab上拉取指定分支到本地仓库;git如何利用分支进行多人开发 ;多人合作代码提交实践

    例如:将gitLab 上的dev分支拉取到本地 git checkout -b dev origin/dev 在本地创建分支dev并切换到该分支 git pull origin dev 就可以把git ...

  5. [git] 更新到某个指定版本

    [git] 更新到某个指定版本 - Vanquisher - 博客频道 - CSDN.NET     [git] 更新到某个指定版本    2015-09-06 09:30 527人阅读 评论(0) ...

  6. git 签出(恢复)指定文件

    在项目开发中,偶尔会因为误删文件或其他原因需要从git仓库中恢复某些文件.此篇文章将介绍如何通过git从历史提交记录.分支记录恢复指定文件. 1. git checkout 说明:使用git chec ...

  7. git合并分支上指定的commit

    merge 能够胜任平常大部分的合并需求.但也会遇到某些特殊的情况,例如正在开发一个新的功能,线上说有一个紧急的bug要修复.bug修好了但并不像把仍在开发的新功能代码也提交到线上去.这时候也许想要一 ...

  8. Git如何检出指定目录或文件

    系统版本:Window 10,Git 版本:2.7.1 对于大型 Git 仓库,每次执行 Git 命令,都需要经过漫长的等待,特别是要经常执行的 git status 命令.下面是一个例子... 从 ...

  9. Git 将代码回到指定版本

    将代码回到hash为1fbcb7ea3b43df60c639875d2bb68e20b451059e的版本 git checkout 1fbcb7ea3b43df60c639875d2bb68e20b ...

随机推荐

  1. ajax对象的获取及其常用属性

    ajax对象的获取及其常用属性 (1)什么是ajax asynchronous javascript and xml(异步的javascript和xml). 是一种用来改善用户体验的技术,其实质是利用 ...

  2. ie7中position:fixed定位后导致margin:0 auto;无效

    布局网页时,需要把header固定在上方.直接使用position:fixed;现代浏览器以及ie8以上均正常显示,但是ie7中,header里面的子元素设置的水平居中并没有效果.做了各种尝试,都没有 ...

  3. NOJ——1559Jump to the Top of Mountain(简单暴力DFS+渣渣代码)

    [1559] Jump to the Top of Mountain 时间限制: 1000 ms 内存限制: 65535 K 问题描述 Have you played a game named Min ...

  4. BZOJ2653 middle 【二分 + 主席树】

    题目 一个长度为n的序列a,设其排过序之后为b,其中位数定义为b[n/2],其中a,b从0开始标号,除法取下整.给你一个 长度为n的序列s.回答Q个这样的询问:s的左端点在[a,b]之间,右端点在[c ...

  5. docker (centOS 7) 使用笔记4 - etcd服务

    本次测试的系统包含centos 7.2 64 bit,centos 7.3 64 bit 1. 安装 yum -y install etcd 2. 配置 此处一共准备了3台机器(10.10.10.10 ...

  6. scrapy之download middleware

    官方文档:https://docs.scrapy.org/en/latest/topics/downloader-middleware.html 一 write your own downloader ...

  7. es6总结(三)--数组

  8. declaration specifier, declarator, type specifier

    static struct abc * b; static struct abc : declaration specifier * b : declarator struct abc : type ...

  9. react-dnd 拖拽

    介绍 React DnD 是一组 React 高阶组件,可以用来帮你构建复杂的拖拽接口,同时解耦你的组件.React DnD 非常适合像 Trello 和 Storify 这样的应用,在不同地方通过拖 ...

  10. MongoDB管理与监控

    https://blog.csdn.net/Chen_Victor/article/details/74855050 https://www.cnblogs.com/zhangyinguang/p/5 ...