Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Aug 2011 18:26:18 -0700
From:      Artem Belevich <art@freebsd.org>
To:        Gleb Kurtsou <gleb.kurtsou@gmail.com>
Cc:        mdf@freebsd.org, Adrian Chadd <adrian@freebsd.org>, Jonathan Anderson <jonathan.anderson@cl.cam.ac.uk>, vadim_nuclight@mail.ru, Robert Watson <rwatson@freebsd.org>, freebsd-arch@freebsd.org
Subject:   Re: Official git export (was: Re: FreeBSD problems and preliminary ways to solve)
Message-ID:  <CAFqOu6gVM0URrFdnH7otN30%2BZ-NBYt7VKki-ErvMabb7QLmyaw@mail.gmail.com>
In-Reply-To: <20110826183130.GA40586@tops>
References:  <35765857-1314243257-cardhu_decombobulator_blackberry.rim.net-329610575-@b2.c15.bise7.blackberry> <CAJ-Vmo=v0UkQarauKrvWKdjMTC81BwXmyhU__rnaQeL3z45L-g@mail.gmail.com> <slrnj5ddgp.4ck.vadim_nuclight@kernblitz.nuclight.avtf.net> <CAMBSHm8uX45k0M4on=5Cpw_CKoddA=4oJSNXpH7dGPt=Vy2HOw@mail.gmail.com> <alpine.BSF.2.00.1108261000040.48200@fledge.watson.org> <CAJ-Vmo=OWz2TjWRrLBeRW3CCZjyVfTDajY9TYGZgzDQ7G3GBag@mail.gmail.com> <CAMGEAwD_v91bf_8e9mJXQa53OGdtqpiMJR%2B9sF0jOLkoDu94tQ@mail.gmail.com> <CAJ-Vmo=H6AKv3Emqa5GjSThEGy8P-utLyGNR6dRuKraqnyTSAQ@mail.gmail.com> <alpine.BSF.2.00.1108261222350.48200@fledge.watson.org> <CAMGEAwB_V8m7HNwxWMhfmNaX97f87gKVj_bOEeTLdLfjY4pjfA@mail.gmail.com> <20110826183130.GA40586@tops>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,

On Fri, Aug 26, 2011 at 11:31 AM, Gleb Kurtsou <gleb.kurtsou@gmail.com> wrote:
> Jonathan, could you update /Git wiki page with an example of git clone
> specifying only head branch and how to add another branch later. That
> would make local repository copy smaller, pull faster and
> 'git branch -r' output much shorter.

Here you go:

     $ mkdir small-clone
     $ cd small-clone
     $ git init
     # Tell git to fetch only master (AKA head) and stable/8 branches
     $ git remote add -t master -t stable/8 origin
git://git.freebsd.your.org/freebsd.git
     $ git fetch origin    # fetches about 1.6M objects

     remote: Counting objects: 1600952, done.
     remote: Compressing objects: 100% (418377/418377), done.
     remote: Total 1600952 (delta 1227540), reused 1524707 (delta 1159458)
     Receiving objects: 100% (1600952/1600952), 632.85 MiB | 3.12 MiB/s, done.
     Resolving deltas: 100% (1227540/1227540), done.
     From git://git.freebsd.your.org/freebsd
       * [new branch]      master     -> origin/master
       * [new branch]      stable/8   -> origin/stable/8

     # Add stable/7 branch and fetch it
     $ git remote set-branches origin --add stable/7
     $ git fetch origin

     remote: Counting objects: 35713, done.
     remote: Compressing objects: 100% (11359/11359), done.
     remote: Total 27595 (delta 20679), reused 22440 (delta 16043)
     Receiving objects: 100% (27595/27595), 14.40 MiB | 1.93 MiB/s, done.
     Resolving deltas: 100% (20679/20679), completed with 2329 local objects.
     From git://git.freebsd.your.org/freebsd
        * [new branch]      stable/7   -> origin/stable/7
     $ git branch -r
       origin/HEAD -> origin/head
       origin/master
       origin/stable/7
       origin/stable/8

Practically it does not save you all that much on repo size or the
time to fetch stuff. Complete clone is ~700M/1.9M objects and
head+stable/8 clone is only about 10% smaller. If you really want to
have smaller repo you will need to trip repo history. I'm not sure yet
how to do that.

--Artem



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFqOu6gVM0URrFdnH7otN30%2BZ-NBYt7VKki-ErvMabb7QLmyaw>