


























When we are working on a real project, we may want to know from which commit a particular line is introduced.
We can use the following git-log command to find:
For example, to find when the line foo = foo + bar was introduced, we may use the following command:
git log -S "foo = foo + bar"It will find the commit that created this line.
Another similar command is git-blame, for example, to find which commit introduced line 100, we can use the following command:
In fact, git-blame shows the most recent change to this line. So if this line has been updated since its creation, for example, you have removed the trailing white spaces or renamed variables in this line, git-blame does not work.
Ref:
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。