dongwo7858 2018-03-29 04:38
浏览 26
已采纳

给定行Git的函数名称

Is there a way in git log to give it as input a line number of a file, and it return the function or class name.

  • 写回答

1条回答 默认 最新

  • drlnsli18864734 2018-03-29 05:19
    关注

    In latest version (I'm not sure which version onward) of git, the option -L introduced. from this you can print the line changes. it will display the complete content of those lines. you can play with this option to print only range of revisions which explained here

    -L <start>,<end>:<file>
    -L :<funcname>:<file>
    

    Usage: (I don't have any php project, so tested with c Project)

    tshetty@ubuntu:~/work/linux$ git log -L 44,44:arch/arm/common/scoop.c 
    commit 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2
    Author: Linus Torvalds <torvalds@ppc970.osdl.org>
    Date:   Sat Apr 16 15:20:36 2005 -0700
    
    ...........................
    .................
    diff --git a/arch/arm/common/scoop.c b/arch/arm/common/scoop.c
    --- /dev/null
    +++ b/arch/arm/common/scoop.c
    @@ -0,0 +26,1 @@
    +void reset_scoop(struct device *dev)
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 宇视监控服务器无法登录
  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥15 DruidDataSource一直closing
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥50 power BI 从Mysql服务器导入数据,但连接进去后显示表无数据