Vim Fugitive: Gblame reblame options

喜欢而已 提交于 2019-12-12 08:51:16

问题


I've been using Fugitive's Gblame recently but don't quite understand what "reblame" does.

Can someone describe a little more clearly what these options do:

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

回答1:


Think of reblame as navigating to a commit and then running blame on your file or git blame <commit> -- <file>

  • - the simplest case. Use the commit in question under your cursor and reblame the file.
  • ~ Is equivalent to running git blame <rev>~[count] -- <file>
  • P Is equivalent to running git blame <rev>^[count] -- <file>

For the common case, i.e. no [count], ~ and P are the equivalent. (Note that [count] defaults to 1)

Quick revision tutorial taken from 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

To understand more about git revision notation see:

  • git help gitrevisions
  • Git Tools - Revision Selection
  • Carats and Tildes, Resets and Reverts Note: this article is talking about reset however the graph and revision part is helpful towards the middle of the article.

For more help with git blame see git help blame



来源:https://stackoverflow.com/questions/25286726/vim-fugitive-gblame-reblame-options

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!