Official git export (was: Re: FreeBSD problems and preliminary ways to solve)

Artem Belevich art at freebsd.org
Sat Aug 27 01:55:49 UTC 2011


Hi,

On Fri, Aug 26, 2011 at 11:31 AM, Gleb Kurtsou <gleb.kurtsou at 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


More information about the freebsd-arch mailing list