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 13, 2006, 14:21 UTC
Message-ID
<ee945j$h3u$1@sea.gmane.org>
In-Reply-To
<4508020F.2050604@sgi.com>
Tim Shimmin wrote:
> I'm new to git and have a couple of novice questions.
> 
> * Is it possible to only pull in a subtree from
> a repository.
I assume that by pull you mean checkout...

I think it is possible (try git-read-tree with --prefix option, and select subtree by giving either it's sha1, or e.g. HEAD:<path> form), but not easy to do. Git revisions are snapshots of the whole project (the revisions are states of the whole project).

> Moreover, is it possible to have a subtree based on another
> repository.

It is possible. For example, make empty directory <subproject> somewhere, add this directory, or just all the files in it either to .gitignore or .git/info/excludes file, then clone the other project (subproject) to this place. You would have the following directory structure

  /
  dir1
  dir2
  dir2/subdir
  subproject
  subproject/.git
  subproject/subprojectsubdir
  ...
Show 6 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
> I just want to see what is exactly stored in the .git
> binary files and how they change when I do various git
> operations.

Loose object are stored type+compressed contents. But usually everything except latest work is in packs.

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
Previous: Tim ShimminNext: Timothy Shimmin
Message 2 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.