#clone #git-tool #git #directory #tool #command-line-tool #cli

app clone-github-subdir

Clone any sub-directory of a Github repository to your local machine

2 releases

0.1.1 Jul 30, 2023
0.1.0 Jul 30, 2023

#34 in #git-tool

MIT license

13KB
199 lines

clone-github-subdir

Clone any sub-directory of a Github repository to your local machine with this handy command-line tool. It is useful if you only want to clone a specific part of a repo.

Installation

You can install clone-github-subdir from crates.io using cargo:

cargo install clone-github-subdir

Or you can build it from source using git:

git clone https://github.com/isurfer21/clone-github-subdir.git
cd clone-github-subdir
cargo build --release

Usage

To use clone-github-subdir, first check if all set via short command cgs along with --help or -h option, e.g.,

> cgs --help
Usage:
 cgs [options] <link>

Arguments:
 link              Github sub-directory URL

Options:
 -h, --help         Show this help message
 -v, --version      Show the program version
 -c, --curdir       Current sub-directory only

You can also use the following options:

  • -h, --help: Show the help message and exit.
  • -v, --version: Show the program version and exit.
  • -c, --curdir: Clone only the current sub-directory, not its parent directory.

Now to clone the GitHub sub-directory, you can provide any GitHub repository's sub-directory URL as an argument, e.g.,

cgs https://github.com/second-state/wasm-learning/tree/master/nodejs/hello

This will clone the nodejs/hello sub-directory of the second-state/wasm-learning repo to your current working directory.

Alternatively, to clone only the target sub-directory, you can use --curdir or -c option , e.g.,

cgs -c https://github.com/second-state/wasm-learning/tree/master/nodejs/hello

This will clone only the hello sub-directory, not its parent directory like nodejs/hello.

License

This project is licensed under the MIT license. See the LICENSE file for more details.

Dependencies

~5–18MB
~258K SLoC