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

Re: git pull a subtree, embedded trees

From
Jakub Narebski <jnareb@gmail.com>
Date
Sep 18, 2006, 05:58 UTC
Message-ID
<eelcgd$830$1@sea.gmane.org>
In-Reply-To
<450E3399.5070601@sgi.com>
Timothy Shimmin wrote:
Show 10 quoted lines
>>> * Are there any tools for dumping out the contents of the
>>> git objects in the .git/objects directory.
>>> By dumping out, I mean an ascii representation of the data
>>> fields for the commit and tree objects in particular.
>>> I've written a simple small program to dump out the index
>>> entries (cache entries).
>> 
>> git-cat-file -p
>> 
> Excellent, thanks. (looks like the option is undocumented - secret option:)
It looks not:
usage: git-cat-file [-t|-s|-e|-p|<type>] <sha1>
       -p     Pretty-print the contents of <object> based on its type.
Show 6 quoted lines
> So I added this to a script which walks over the objects directory,
> to work out what all the object ids are so I can apply git-cat-file
> to all the objects on my test directory.
> I guess this will fall down if the objects are stored in a pack :)
> I'll have to look and see how to extract all the object ids using
> some command.

git-rev-parse and/or git-rev-list (the latter with --objects option) is your friend. And there is git-ls-tree command which list sha1 of blobs (files) and trees (subdirectories) for specific revision (specified tree).

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
Previous: Timothy ShimminNext: Shawn Pearce
Message 4 of 8 in “git pull a subtree, embedded trees”
  1. Tim ShimminSep 13, 2006
  2. Jakub NarebskiSep 13, 2006
  3. Timothy ShimminSep 18, 2006
  4. Jakub NarebskiSep 18, 2006
  5. Shawn PearceSep 18, 2006
  6. Shawn PearceSep 18, 2006
  7. Shawn PearceSep 13, 2006
  8. Timothy ShimminSep 18, 2006

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.