Git: discover which commits ever touched a range of lines

前端 未结 6 411
情话喂你
情话喂你 2020-11-29 19:16

I\'m having trouble figuring out how to use git blame for getting the set of commits that ever touched a given range of lines. There are similar questi

6条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-29 19:33

    A few thoughts..

    This sounds similar to this post, and it looks like you might get close with something like this:

    git blame -L '/variable_name *= */',+1
    

    As long as you know the definition to match against (for the regex).

    There is a thread discussion here, about using tig and git gui (which apparently might handle this). I haven't tried this myself yet, so can't verify it (I'll give this a try later).

提交回复
热议问题