Alberto Embedded & Open experience

Notes on my experience on Open Source Embedded Systems

Posts Tagged ‘reference

Git clone with local references

leave a comment »

In this post I explain how to clone a remote git repository basing it on a local one.

If you work with the Linux kernel  there are so many different repositories for developing, so when you are asked to base your patch series on branch x of repo y, if you follow those rules you don’t have the need to re download the n-est Linux kernel repository!

First: You must have a clean linus repository!

Saying the project root dir for developing is $PRJROOT we can setup a clean linus repo with:

$ cd $PRJROOT
$ mkdir kernel-linus
$ cd kernel-linus
$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git

Second: clone a remote repository referencing the local linus one:

The parameter –reference in the git clone command make what we need

$ cd $PRJROOT
$ mkdir kernel-mfd
$ cd kernel-mfd
$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6.git \
  --reference ../kernel-linus/linux-2.6/

Pay attention that the default behaviour for git in local referencing is to setup a .git/objects/info/alternates to share the objects with the source repository, resulting in much more space occupied but deleting old objects  in the new one, deletes the same in the old one that is not always a good thing.

So only go ahead in referenced local repositories 🙂

Bye!

Alberto!

Written by Alberto!

11/12/2009 at 6:03 pm

Posted in Git

Tagged with , ,