Vim Fugitive:Gblame重新定位选项

11

我最近一直在使用Fugitive的Gblame,但不太理解"reblame"是什么意思。

有人能更清楚地描述一下这些选项的作用吗:

 -     reblame at commit
 ~     reblame at [count]th first grandparent
 P     reblame at [count]th parent (like HEAD^[count])
1个回答

13

将reblame视为导航到提交,然后在文件上运行blame或git blame <commit> -- <file>

  • - 最简单的情况。 使用光标下的问题提交并重新对文件进行归咎。
  • ~ 等同于运行 git blame <rev>~[count] -- <file>
  • P 等同于运行 git blame <rev>^[count] -- <file>

对于常见情况,即没有 [count]~P 是等效的。(注意,默认值为 1

快速修订教程取自 git help gitrevisions:

Here is an illustration, by Jon Loeliger.
Both commit nodes B and C are parents of commit node A.
Parent commits are ordered left-to-right.

G   H   I   J
 \ /     \ /
  D   E   F
   \  |  / \
    \ | /   |
     \|/    |
      B     C
       \   /
        \ /
         A
A =      = A^0
B = A^   = A^1     = A~1
C = A^2  = A^2
D = A^^  = A^1^1   = A~2
E = B^2  = A^^2
F = B^3  = A^^3
G = A^^^ = A^1^1^1 = A~3
H = D^2  = B^^2    = A^^^2  = A~2^2
I = F^   = B^3^    = A^^3^
J = F^2  = B^3^2   = A^^3^2

了解更多关于 git 修订符号的信息,请参见:

如需更多关于 git blame 的帮助,请参见 git help blame


2
谢谢,这行代码帮我搞清楚了:“把 reblame 想象成导航到一个提交,然后在你的文件上运行 blame”。 - Jonathan.Brink

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接