Created
November 1, 2018 02:48
-
-
Save cocodrino/ba9481698533f3b8019b511fd283f17f to your computer and use it in GitHub Desktop.
download subfolder github
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For other users who just want to download a file/folder from github, simply use: | |
svn export <repo>/trunk/<folder> | |
e.g. | |
svn export https://github.com/lodash/lodash.com/trunk/docs | |
(yes, that's svn here. apparently in 2016 you still need svn to simply download some github files) | |
Courtesy: Download a single folder or directory from a GitHub repo | |
Important - Make sure you update the github URL and replace /tree/master/ with '/trunk/'. | |
As bash script: | |
git-download(){ | |
folder=${@/tree\/master/trunk} | |
folder=${folder/blob\/master/trunk} | |
svn export $folder | |
} | |
source https://stackoverflow.com/questions/600079/how-do-i-clone-a-subdirectory-only-of-a-git-repository | |
Note This method downloads a folder, does not clone/checkout it. You can't push changes back to the repository. On the other hand - this results in smaller download compared to sparse checkout or shallow checkout. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment