Git 查看n行到m行代码历史变化
本文介绍了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中变化的情况?
解决方案
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.
这篇关于Git 查看n行到m行代码历史变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文