Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent download of whole git repository

Tags:

git

github

I have a git repository for a hobby game i'm working on which I push to a private repository on github as a backup and central location for the code.

In old versions I have 100MB or so of .TGA files as textures but I've changed these to smaller .DDS files in newer version.

But when you clone the repository from github it still downloads all the unused old files as far as I can tell, not just the ones in the latest commit. This makes sense as you are cloning the repository, not just checking out the current version. But they are a useless large download most of the time.

But is there any way I can stop it downloading files from the oldest versions without preventing me from getting at them should I need to?

Failing that, how can I remove those old revisions, and the files that are no longer used from my remote repository?

like image 850
jcoder Avatar asked Nov 18 '12 09:11

jcoder


1 Answers

Use the --depth option when you're cloning it from GitHub, to get only the latest revision.

git clone --depth=1 https://github.com/user/repo

From the manual...

Create a shallow clone with a history truncated to the specified number of revisions. A shallow repository has a number of limitations (you cannot clone or fetch from it, nor push from nor into it), but is adequate if you are only interested in the recent history of a large project with a long history, and would want to send in fixes as patches.

If you're wondering what options exist for Git commands, you can use git help command or man git-command.

like image 166
alex Avatar answered Oct 13 '22 22:10

alex