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

Re: Git tree/blob and corresponding commit

From
Jonathan Nieder <jrnieder@uchicago.edu>
Date
Aug 10, 2008, 20:38 UTC
Message-ID
<Pine.GSO.4.62.0808101519220.16851@harper.uchicago.edu>
In-Reply-To
<489F208B.2070006@obry.net>
Pascal Obry wrote:
> Now given a SHA1 I'd like to know which commit has created (was containing)
> this specific blob?

Why do you want to know? The right method depends on your reason. You probably know more than I do about this, but here are my thoughts.

If some loose object of yours got corrupted and you are trying to see what exactly is missing, then (for this task) you are in luck. See <http://www.kernel.org/pub/software/scm/git/docs/howto/recover-corrupted-blob-object.txt>.

If some packed object got corrupted, I'd be interested to hear how this is handled. I think there was discussion recently of how to recover from that situation. If you have the luxury, it might be good to use unpack-objects to get to the first situation.

But I think that is not your situation. I'll assume for definiteness that some source file appeared out of thin air in your /lost+found and you are trying to figure out what it is. Then see <http://thread.gmane.org/gmane.comp.version-control.git/44750/focus=44754> and surrounding discussion. You could use "git ls-tree -r" if you do not have the filename.

Hope that helps, Jonathan

Previous: Pascal ObryNext: Jonathan Nieder
Message 2 of 5 in “Git tree/blob and corresponding commit”
  1. Pascal ObryAug 10, 2008
  2. Jonathan NiederAug 10, 2008
  3. Jonathan NiederAug 10, 2008
  4. Pascal ObryAug 14, 2008
  5. Bryan DonlanAug 15, 2008

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.