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 yolov8边框坐标
  • ¥15 matlab中使用gurobi时报错
  • ¥15 WPF 大屏看板表格背景图片设置
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真