How to avoid cloning full git repository

I was used to clone the NuttX git repository all the time I need a clean copy. But this is not a good idea, because it waste time and increase the network traffic.

Sebastien Loquert gave a suggestion to improve it:

$ sudo mkdir /opt/nuttx

$ cd /opt/nuttx

$ git clone https://bitbucket.org/nuttx/nuttx

$ git clone https://bitbucket.org/nuttx/apps

$ cd ~/nuttxspace

$ git clone /opt/nuttx/nuttx nuttx

$ git clone /opt/nuttx/apps apps

$ cd nuttx

$ git pull

$ cd ../apps

$ git pull

This simple tips will reduce the time I waste download the full repository and will reduce the network traffic. It is important if you are using 3G/4G and you pay by amount of the downloaded data.

Advertisements

2 thoughts on “How to avoid cloning full git repository

  1. Thanks! But…
    1. Would it be better to make first two “git clone” as –bare
    2. Why do you do “git pull” right after cloning?

  2. Hi Alexander,
    Thank you for this suggestion. I did “git pull” to update the local master with mainline master, but it is wrong because it was pointing to local origin that was used to clone. So I could copy the config before executing the pull: $ cp /opt/nuttx/nuttx/.git/config nuttx/.git/config

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 )

Google+ photo

You are commenting using your Google+ 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 )

w

Connecting to %s