[英]How to find the diff history of specific line in a file using git?
I want to find a list of history for a specific line in a file for example 我想在文件中查找特定行的历史记录列表
file: something.txt
1/2
line 1: // change comment to 1
2/15
line 1: // change comment to 2
12/15
line 1: // change comment to 4
If I do git blame
it only shows 12/15
entry, and if there is tons of commit between 2/15
and 12/15
then git log
is not really useful 如果我做git blame
,它只显示12/15
条目,并且如果在2/15
和12/15
之间有大量的提交,那么git log
并不是真的有用
Can someone give me some advice? 有人可以给我一些建议吗?
Thanks 谢谢
For your example: 例如:
git log -L 1,1:something.txt
From the documentaion 来自文献
-L <start>,<end>:<file> -L <开始>,<结束>:<文件>
-L :<funcname>:<file> -L:<函数名>:<文件>
Trace the evolution of the line range given by "<start>,<end>" (or the function name regex <funcname>) within the <file>. 跟踪<file>中“ <start>,<end>”(或函数名regex <funcname>)给定的行范围的演变。 You may not give any pathspec limiters. 您不得提供任何pathspec限制器。 This is currently limited to a walk starting from a single revision, ie, you may only give zero or one positive revision arguments. 当前,这仅限于从单个修订版本开始的遍历,即,您只能给出零个或一个正修订版本参数。 You can specify this option more than once. 您可以多次指定此选项。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.