zoukankan      html  css  js  c++  java
  • 使用".."指定git提交范围与"..."指定git提交范围的区别

    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

    [plain] view plaincopy
     
    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.
    

     

  • 相关阅读:
    Tomcat vs Jetty vs Undertow性能对比
    实例对象( instance)、类对象(class)、元类对象(meta-class)的内部结构分析
    isa和superclass
    iOS-weak关键字使用场景
    iOS-weak和assign区别,copy和strong的区别和应用
    iOS-class修饰符的解释及用法
    iOS-atomic修饰符原理剖析讲解 (你将会了解到什么是优先级翻转、自旋锁、互斥锁)
    @property修饰符种类
    @property、@synthesize 、@dynamic的应用
    【原创】Kafka Consumer多线程消费
  • 原文地址:https://www.cnblogs.com/baiyw/p/3757322.html
Copyright © 2011-2022 走看看