【问题标题】:"A..B" (double-dot) vs "--right-only A...B" (filtered triple-dot) in Git commit ranges?Git提交范围中的“A..B”(双点)与“--right-only A...B”(过滤的三点)?
【发布时间】:2013-09-28 20:41:29
【问题描述】:

比较What are the differences between double-dot ".." and triple-dot "..." in Git commit ranges?,这是一个更常见的有用问题。

我想澄清以下是否产生与git log A..B 相同的提交集:

# version 1
git log --right-only A...B 

# version 2
#
# (The sed part keeps only the righthand lines, and strips the > character)
git log --left-right --format=oneline A...B | sed -n "s/^>//p"

他们会似乎以更迂回的方式来完成同样的事情。

最初的动机是更深入地理解这些命令的含义,其中涉及忽略已经挑选的提交:

# version 1a
#
# Literally taken from the git-log help page, which explains what this means
git log --cherry-pick --right-only A...B 

# version 2a
#
# This is a simplified version of something in the git code. (In particular,
# in git-rebase--interactive.sh.)
git log --left-right --cherry-pick --no-merges --format=oneline A...B | sed -n "s/^>//p"

这个问题的延伸是问为什么需要对称差异(即三点)来进行这种“单面”的樱桃选择消除。例如,要找到 B 上的唯一提交,包括对樱桃挑选的更正,难道不应该做一些像

这样简单的事情吗?
git log --cherry-pick A..B

我想这是因为 git 在 之后应用了去除樱桃的逻辑,它用A..B 过滤掉了所有 A 提交。 (也就是说,在这个假设的命令中,git 在尝试应用挑选逻辑之前会丢弃与 A 相关的所有内容。)

【问题讨论】:

    标签: git git-log git-cherry-pick git-rev-list


    【解决方案1】:
    git log --cherry-pick A..B
    

    是一样的

    git log --cherry-pick ^A B
    

    这基本上是所有 B 提交,它们是 A 的注释部分。如果所有 A 提交都被删除,那么 Git 应该与什么进行比较?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-10-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-08
      • 2021-10-04
      • 1970-01-01
      相关资源
      最近更新 更多