gpt4 book ai didi

linux - 如何使用git查找文件中特定行的差异历史记录?

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:48:34 26 4
gpt4 key购买 nike

例如,我想查找文件中特定行的历史记录列表

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

如果我执行 git blame 它只显示 12/15 条目,如果在 2/1512/15 然后 git log 不是很有用

有人可以给我一些建议吗?

谢谢

最佳答案

以你的例子为例:

git log -L 1,1:something.txt

来自documentaion

-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.

关于linux - 如何使用git查找文件中特定行的差异历史记录?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34279236/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com