On Thu, 26 May 2016 08:44:03 -0700
Michael <keybou...@gmail.com> wrote:

> > Impossible with `git clone` as it's tailored for the most common
> > case which is "get everything".
> > You need a two-step operation:
> > 
> >  git init vlc
> >  cd vlc
> >  git fetch https://github.com/videolan/vlc.git
> > 412dd75428226d10044e80e741addecb24dbedb5:mybranch
> > 
> > This command will create a local branch "mybranch" which tip commit
> > will be that one identified by that SHA-1 hash.
> 
> More to the point, this is the first time that I've seen that it's
> even possible to start with less than a full clone. Thank you.

BTW this is not merely "a neat trick": the fact Git is perfectly able
to fetch any chain of commits from anywhere into the local repository
and create a ref pointing to it has practical uses for already existing
repositories -- not just a way to "start small".  This approach is used
for stitching histories of independent repositories using
`git subtree split` ... `git subtree add` and "vendoring" external code
by means of using the so-called subtree merging.

As to `git clone` itself, it's also not too limited in its capabilities
with regard to getting less history the source repo contains: look at
its "--depth" and "--single-branch" command-line options.  It just
appears to not support directly the OP's requirement: fetch via an
arbitrary commit name rather than ref name.

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to