Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/MohamedElashri/gh-cp
Github cli extension to allow copying single files from repository without cloning
https://github.com/MohamedElashri/gh-cp
gh-extension
Last synced: about 2 months ago
JSON representation
Github cli extension to allow copying single files from repository without cloning
- Host: GitHub
- URL: https://github.com/MohamedElashri/gh-cp
- Owner: MohamedElashri
- License: mit
- Created: 2024-06-08T07:40:44.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-06-08T08:56:49.000Z (8 months ago)
- Last Synced: 2024-12-07T22:30:56.999Z (about 2 months ago)
- Topics: gh-extension
- Language: Shell
- Homepage:
- Size: 5.86 KB
- Stars: 13
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-useful-projects - <img src="https://icon.horse/icon/github.com" height="20px" align="center"/>/MohamedElashri/gh-cp - GitHub CLI extension to copy files without cloning (Jump To / **Command Line Tools**)
- awesome-useful-projects - <img src="https://icon.horse/icon/github.com" height="20px" align="center"/>/MohamedElashri/gh-cp - GitHub CLI extension to copy files without cloning (Jump To / **Command Line Tools**)
README
# GitHub CLI Extension: gh-cp
`gh-cp` is a GitHub CLI extension that allows you to easily copy files from a GitHub repository to a local destination. With `gh-cp`, you can seamlessly download specific files or multiple files from a repository, optionally specifying a branch or commit to copy from.## Features
- Copy files from a GitHub repository to a local destination
- Support for copying multiple files in a single command
- Option to specify a branch or commit to copy files from
- Read file paths from a file for bulk copying## Requirements
- [GitHub CLI](https://cli.github.com/) (version 2.0.0 or later)
- A GitHub account with appropriate permissions to access the repository## Installation
To install the `gh-cp` extension, follow these steps:1. Ensure that you have [GitHub CLI](https://cli.github.com/) installed on your system.
2. Install the `gh-cp` extension using the following command:
```
gh extension install MohamedElashri/gh-cp
```
This command will clone the `gh-cp` repository to your local extensions directory and make it available as a `gh` command.
3. Verify the installation by running:
```
gh cp --help
```
If the installation is successful, you should see the help message for the `gh-cp` extension.## Usage
The basic syntax for using `gh-cp` is as follows:
```
gh cp [OPTIONS] [...] []
```
- ``: The repository in the format 'owner/repo'.
- `...`: The paths to the files in the repository (separated by space).
- ``: The local destination directory (optional, default: current directory).### Options
- `-h`, `--help`: Show the help message and exit.
- `-f`, `--file `: Read file paths from a file (one path per line).
- `-b`, `--branch `: Specify the branch to copy files from (default: main).
- `-c`, `--commit `: Specify the commit hash to copy files from.### Examples
1. Copy a single file from a repository:
```
gh cp myuser/myrepo path/to/file.txt
```
2. Copy multiple files from a repository to a specific local directory:
```
gh cp myuser/myrepo path/to/file1.txt path/to/file2.txt /local/directory
```
3. Copy files specified in a file:
```
gh cp -f path_file.txt myuser/myrepo
```
The `path_file.txt` should contain file paths, one per line.
4. Copy files from a specific branch:
```
gh cp -b feature-branch myuser/myrepo path/to/file.txt
```
5. Copy files from a specific commit:
```
gh cp -c a1b2c3d4 myuser/myrepo path/to/file.txt
```Note: Make sure you have the necessary permissions to access the files in the repository.
## Contributing
Contributions to `gh-cp` are welcome! If you encounter any issues, have suggestions for improvements, or would like to add new features, please open an issue or submit a pull request on the [GitHub repository](https://github.com/MohamedElashri/gh-cp).## License
`gh-cp` is open-source software licensed under the [MIT License](https://github.com/MohamedElashri/gh-cp/blob/main/LICENSE).
```