git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Douglas Garstang <doug.garstang@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: git cloning paths
Date: Fri, 13 Jul 2012 04:07:31 -0400	[thread overview]
Message-ID: <20120713080731.GA32303@sigill.intra.peff.net> (raw)
In-Reply-To: <CANmEAK_jGdzR9R=0DexC+-_0U6mb_7o_v5zSKTuhgoaYCaSiFQ@mail.gmail.com>

On Thu, Jul 12, 2012 at 03:17:09PM -0700, Douglas Garstang wrote:

> I'm a relative newcomer to git and I've just inherited a setup where
> all of the company's code is in a single git repository. Within this
> repository are multiple projects. It seems that git doesn't natively
> allow cloning/checking out of individual paths within the repo (ie
> projects), which would seem to make integrating git with a continuous
> build system rather difficult. That is, the build system has to clone
> the entire repo, and therefore a change to any project will result in
> the entire contents of the repo being built.
> 
> Correct....?

Yes. The feature you are looking for is either "sparse checkout" (only
check out a subset of the files in the repository databse to the working
tree) or "sparse clone" (only copy a subset of the files into the local
repository database during clone). Git v1.7.0 and later has sparse
checkout (see the "sparse checkout" section in "git help read-tree").
There is no implementation for sparse clone (and not likely to be one
any time soon, as it introduces a lot of complexity into the object
negotiation phase).

The usual advice is that you should break up your big repository into
logical projects. You can do so with git-filter-branch, but beware that
this involves rewriting history, which means a flag day for everybody
switching to the new history (or dealing with migrating commits from the
old history to the new history via rebase).

Finally, if you have a build system which is cloning repeatedly, you may
want to keep a repository on the build server all the time and just
fetch the updates into it. This is much more efficient even if you do
end up paring down your repository.

-Peff

  reply	other threads:[~2012-07-13  8:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-12 22:17 git cloning paths Douglas Garstang
2012-07-13  8:07 ` Jeff King [this message]
2012-07-25 15:22 ` Caleb Marchent

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120713080731.GA32303@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=doug.garstang@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).