Efan Harris
Efan Harris

Reputation: 35

Git, With given change in source, how to find commit number?

I Know in file foo.cpp Following Line has been added some time this year

if(engL.showPrompt()>engL.lessPrompt())
     executeScript();

How to find which commit pushed this change?

Upvotes: 0

Views: 118

Answers (2)

Michael Wild
Michael Wild

Reputation: 26371

If the change is not in the last commit, you can use

git log -S"if(engL.showPrompt()>engL.lessPrompt()) executeScript()" -- path/to/file

Upvotes: 3

Rob Di Marco
Rob Di Marco

Reputation: 44962

git blame foo.cpp will show you line by line what commit was the last one to contribute to that line.

Upvotes: 4

Related Questions