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.
    

     

  • 相关阅读:
    一行转多行 及多行转一行的 hive语句
    sparkSQL、dataframe
    特征工程
    python相关
    pyspark dataframe 格式数据输入 做逻辑回归
    hive sql 随机抽样
    pyspark 逻辑回归程序
    3.27模拟赛
    luogu P3217 [HNOI2011]数矩形
    bzoj 4403 序列统计
  • 原文地址:https://www.cnblogs.com/baiyw/p/3757322.html
Copyright © 2011-2022 走看看