问题描述
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中变化的情况?
问题解答
回答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.