On Wed, Nov 28, 2012 at 02:13:32PM -0500, Dale R. Worley wrote:

> I am just beginning to use git.  I've read the O'Reilly book (by
> Loeliger and McCullough), and (unexpectedly) it didn't give me a clear
> view of some of the messier aspects of git.  So as a first question,
> I'd like to know if anyone knows of an exposition that gives a clear
> and accurate description of the logical structure of git repositories
> and git operations.

"Git from the bottom up" [1] is still relevant.
It's mentioned in the official documentation page [2] which contains
other documents of interest.

The manual pages for the low-level ("plumbing") commands also might shed
some light on the subject, but it's more hard-core reading for sure.

> As a second question, consider a situation I am now in.  I've been
> using git to maintain a repository of a directory.  I now want to
> start tracking all the files in the *parent* of that directory,
> continuing the history of all the files that are now in the
> repository.  I know how to use Subversion to do this, with one or two
> commands I can move the repository files into a subordinate directory
> in the repository.  But what is the correct way to do this in git?

As Ryan already suggested, you could go the `git mv` route.
Another approach is to use the `git-subtree` script which was an
external project for some time [3] but since some version of Git moved
to its "contrib" directory and is available right away.

With git-subtree you can create a *new* repository, add those files
"from the parent directory" you mentioned in your problem statement,
commit, and then inject your existing repository into it as a
subdirectory *preserving its history*.

The "add" command of `git-subtree` actually employs the so-called
"subtree merging" technique [4], whih you can also use manually as in
your case this will be a one-off operation.

It worth repeating that this route will result in a brand new repository,
and hence this might raise certain social problems.  Take your pick.

1. http://newartisans.com/2008/04/git-from-the-bottom-up/
2. https://git.wiki.kernel.org/index.php/GitDocumentation
3. https://github.com/apenwarr/git-subtree


Reply via email to