Three.js: A new branch only contains source codes

Created on 12 Jul 2018  路  13Comments  路  Source: mrdoob/three.js

Since the master branch is so huge and most of them are models, images, etc.
Can you just create a new branch that only cantains source code and document so that other people just need a little time to clone it.
And another new branch that cantains all examples and assets but without source code.

In that case, people could choose what they need.

Suggestion

Most helpful comment

You can use git clone git@github.com:mrdoob/three.js.git --depth=1 to reduce the size of the download.

All 13 comments

I don't vote for this suggestion. Most users normally clone the repo just once. Having more branches with different contents makes the project management just more complicated.

In some countries, clone three.js need more than 1 hour, and mostly it would be failed due to the internet connection and people need to clone again. In china, the download speed is only about 20KB/s when cloning a banch.

Have you considered to use an approach like suggested in this thread?

https://stackoverflow.com/questions/7106012/download-a-single-folder-or-directory-from-a-github-repo

You can use git clone git@github.com:mrdoob/three.js.git --depth=1 to reduce the size of the download.

In china, the download speed is only about 20KB/s when cloning a banch.

馃槷

Cloning a repo means that it brings all the history, right? So the only solution would be a snapshot somehow.

In china, the download speed is only about 20KB/s when cloning a banch.

funny... I'm Chinese too but with about 20MB/S download speed at my home, the actual bandwidth is 200MB.

I think you can pretty much create this branch on github site in your fork and then do --depth=1 thing on it

Can you just create a new branch that only cantains source code and document ...

@HypnosNova You can actually do something similar without creating a new branch. But, it's a bit more involved and essentially costs about the same to download as a full clone (in the beginning). First, clone the repository using the --depth=1 flag as others have mentioned. Then, create an explicit repository exclude for the examples directory. Afterward, simply delete the existing examples directory and fetch all the previous commits using git pull --unshallow. The repository will update, but the examples directory will not return.

For example:

$ git clone git@github.com:mrdoob/three.js.git --depth=1
Cloning into 'three.js'...
remote: Counting objects: 2787, done.
remote: Compressing objects: 100% (2313/2313), done.
remote: Total 2787 (delta 627), reused 1529 (delta 411), pack-reused 0
Receiving objects: 100% (2787/2787), 216.79 MiB | 7.92 MiB/s, done.
Resolving deltas: 100% (627/627), done.
Checking out files: 100% (2489/2489), done.
$ cd three.js/



md5-8e9dc8f82880e1319c097629059c922c



$ echo 'examples/' >> .git/info/exclude 



md5-8e9dc8f82880e1319c097629059c922c



$ rm -rf examples/



md5-8e9dc8f82880e1319c097629059c922c



$ git pull --unshallow
remote: Counting objects: 169143, done.
remote: Compressing objects: 100% (44440/44440), done.
remote: Total 169143 (delta 125372), reused 166682 (delta 122937), pack-reused 0
Receiving objects: 100% (169143/169143), 375.24 MiB | 7.73 MiB/s, done.
Resolving deltas: 100% (125372/125372), completed with 1160 local objects.
remote: Counting objects: 32, done.
remote: Total 32 (delta 0), reused 0 (delta 0), pack-reused 32
Unpacking objects: 100% (32/32), done.
...



md5-8e9dc8f82880e1319c097629059c922c



$ ll
total 272K
drwxr-xr-x 10 user users 4.0K Jul 16 17:11 .
drwxrwxr-x 21 user users 4.0K Jul 16 17:07 ..
drwxr-xr-x  2 user users 4.0K Jul 16 17:08 build
drwxr-xr-x  8 user users 4.0K Jul 16 17:08 docs
drwxr-xr-x  6 user users 4.0K Jul 16 17:08 editor
drwxr-xr-x  8 user users 4.0K Jul 16 17:12 .git
drwxr-xr-x  2 user users 4.0K Jul 16 17:08 .github
drwxr-xr-x 17 user users 4.0K Jul 16 17:08 src
drwxr-xr-x  4 user users 4.0K Jul 16 17:08 test
drwxr-xr-x  6 user users 4.0K Jul 16 17:08 utils
-rw-r--r--  1 user users   86 Jul 16 17:08 .gitattributes
-rw-r--r--  1 user users  109 Jul 16 17:08 .gitignore
-rw-r--r--  1 user users 1.1K Jul 16 17:08 LICENSE
-rw-r--r--  1 user users   67 Jul 16 17:08 .npmignore
-rw-r--r--  1 user users 2.2K Jul 16 17:08 package.json
-rw-r--r--  1 user users 197K Jul 16 17:08 package-lock.json
-rw-r--r--  1 user users 3.0K Jul 16 17:08 README.md
-rw-r--r--  1 user users  704 Jul 16 17:08 rollup.config.js
-rw-r--r--  1 user users   66 Jul 16 17:08 .travis.yml

Now you have a local repository which excludes examples, but contains a complete history, can be updated, and could be used as a developmental fork.

@msimpson but wait,

Receiving objects: 100% (2787/2787), 216.79 MiB
Receiving objects: 100% (169143/169143), 375.24 MiB

that's still like 600MB download. does not really solve it for TS :(

@makc As I said:

...it's a bit more involved and essentially costs about the same to download as a full clone (in the beginning).

It only has benefit if you plan to stay up-to-date or use the repository for pull requests. Your option is still the best if @HypnosNova simply wants to maintain his own minimized branch.

In any event, you guys pointed out several approaches to solve the OP's problem 馃憤. Thus, a modification of the project's structure is not necessary.

oh btw, you coulddo npm i three:

du -sh ./node_modules/three/
 17M    ./node_modules/three/
du -sh ./node_modules/three/examples/*
3.3M    ./node_modules/three/examples/fonts
9.3M    ./node_modules/three/examples/js
Was this page helpful?
0 / 5 - 0 ratings