• 使用".."指定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.
    

     

  • 相关阅读:
    基本计算器 II
    查看JVM使用的什么垃圾收集器
    java nio 例子
    获取jvm加载的类
    对上传的二进制视频文件进行第一帧截取
    conda与pip
    微信聊天记录导出与分析
    k8s creationTimestamp 参数
    adb logcat使用及Debug技巧
    聊聊HDR
  • 原文地址:https://www.cnblogs.com/baiyw/p/3757322.html
Copyright © 2020-2023  润新知