Subject: Re: git pull a subtree, embedded trees

From: Jakub Narebski <[email-masked]>
Date: Wed, 13 Sep 2006 16:21:56 +0200

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
  ...

> * 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