git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Find commit that referenced a blob first

From
Lars Schneider <larsxschneider@gmail.com>
Date
Jul 19, 2018, 21:02 UTC
Message-ID
<C00CED1F-D685-40E5-A5CC-4040BFD82886@gmail.com>
Hi,

I have a blob hash and I would like to know what commit referenced this blob first in a given Git repo.

I could iterate through all commits sorted by date (or generation number) and then recursively search in the referenced trees until I find my blob. I wonder, is this the most efficient way to solve my problem? Is there some trick/existing Git command that would perform this search more efficiently for large repos?

Thank you, Lars

Next: Stefan Beller
Message 1 of 6 in “Find commit that referenced a blob first”
  1. Lars SchneiderJul 19, 2018
  2. Stefan BellerJul 19, 2018
  3. Lars SchneiderJul 19, 2018
  4. Jeff KingJul 19, 2018
  5. Junio C HamanoJul 19, 2018
  6. Stefan BellerJul 19, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.