Git 查看n行到m行代码历史变化

Git 仓库里有5000次提交,每次提交都对文件名为

  chuxiandi_file

做了修改。

  PS:chuxiandi_file 可以翻译成“出现帝”。

其中,chuxiandi_file中有一个function 名为

  xianshijing_function

其中,xianshijing_function 占据50行--100行。
当然,xianshijing_function 虽然不可能在每次提交中都被修改了,但是确实在很多次commit中被修改了。

  PS: xianshijing_function 可以翻译成“现世精”

那么问题来了,git 能不能实现只查看xianshijing_function在5000次commit中变化的情况?

阅读 2.3k
1 个回答
man git-log

里边有写:

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

Trace the evolution of the line range given by "<start>,<end>" (or the function name regex <funcname>) within the <file>. You may not give any pathspec limiters. This is currently limited to a walk starting from a single revision, i.e., you may only give zero or one positive revision arguments. You can specify this option more than once.

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题