I have some block of code commited to a repo a long long time ago. I need to find the commit id, but I don't even remember neither commit's title not its author.

Is there any way to find the id?

1 Answer 1


Assuming you know the line number git log or git blame will tell you all the edits for a given line and the commit id when used like this:

git log -L <start line>,<end line>:<filename>


git blame -L <start line>,<end line> filename

Alternately, if you know the contents of the edit, you can use git blame and a regular expression as detailed here:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.