Fork file from git repository without repo cloning

Is there a way to unlock a file from an external git repository without cloning the entire repo?

+4
source share
2 answers

The closest thing you can do is using sparse control , which means using Git 1.7+, and you still need to clone the repo (or use the clone --depth option to make a small clone). By going mainly from this answer , you can do the following:

 git clone --no-checkout <URL to git repo> myrepo cd myrepo git config core.sparseCheckout true vim .git/info/sparse-checkout # Add files you want checked out git checkout <branch you want> 

If you have Git version 1.7.7-rc0 or later, you can set configuration parameters using the clone command:

 git clone --config core.sparseCheckout=true --no-checkout <URL to git repo> myrepo 

Also see the following:

+2
source

Unlike Subversion, git does not support partial checks.

-3
source

Source: https://habr.com/ru/post/1385493/


All Articles