Alberto Embedded & Open experience

Notes on my experience on Open Source Embedded Systems

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!

Advertisements

Written by Alberto!

11/12/2009 at 6:03 pm

Posted in Git

Tagged with , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: