[sr-dev] download one git branch only

Andrei Pelinescu-Onciul andrei at iptel.org
Tue Oct 13 18:02:02 CEST 2009


On Oct 13, 2009 at 15:39, Daniel-Constantin Mierla <miconda at gmail.com> wrote:
> Hello,
> 
> is anyone aware of a git command that downloads locally only one branch 
> of sip repository?

No, I don't think there is such a tool.

If it's about space, you could clone with a depth limit (but then you
end up with a read-only repo, you cannot push changes outside).

OTOH hand you could try doing the following:
- clone repo normally
- delete all the branches you are not interested in
- run git reflog --expire-unreachable=1    and maybe with --all
- run git prune
- run git gc --aggressive --prune=today
- run git repack

At the end you should end up with only commits reachable from your
branch (but note that I never tried this).

Intead of git reflog... you could try cloning your local repo (the clone
won't know about the deleted branches and won't have a "journal" with
old branch positions).

Note though that after that you should only run
git fetch -n origin <your_branch>:origin/<your_branchy>  or everything 
will be sync'ed back.

> 
> I searched on the web and found only some tools, but maybe there are 
> standard git commands to help.

Andrei



More information about the sr-dev mailing list