ghclone is a free command line tool to clone subdirectories from git repositories. Think of it as a traditional git clone alternative but for subdirectory as well. You use it in the same way as the official clone command of Git and it will clone whatever path you specify in the next argument. Git clones the entire directory from remote repo on your PC but ghclone will only clone the specified directory as specified by you in the repository URL. You can install it directly from the command line and then start using it right away anytime you want.
Sometimes if you want to have only specific folder from a Git repository then you usually have to clone the entire directory. Even though there are software or Chrome extensions to do the same. But if you are a terminal savvy kind of user then you will like ghclone. This is a fairly simple tool and only supports the clone command for now. To do other things in the directory that you have already cloned, you will need the original Git CLI.
How to Git Clone Subdirectories from Remote Git Repositories?
In order to set up ghclone, you will have to install it first using Python package manager. Make sure that you have Python installed and all you have to do is run the following command. It will install ghclone on your PC and then you can start using it.
pip install git+git://github.com/HR/github-clone#egg=ghclone
Now, you just use it in the same way as git clone command. Instead of Git repository, here you have to specify the report git directory or a subdirectory. It should work with all the Git providers but in my case I tested it on GitHub.
ghclone "any git subdirectoy"
In this way, you can use this simple and powerful tool to git clone subfolders from remote Git repositories. The process is very simple and straightforward and you can use it anytime you want.
As a CLI git user I am really happy to try ghclone and the way it works. I sometime have to only clone to a specific directory and this tool makes that very easy. Now, from the terminal I can clone any subfolder or subdirectory from any Git repository by running a simple command.