#git-repository #local #directory #file

bin+lib gitcp

Copy files from Git repository to local

3 unstable releases

0.3.1 Jul 31, 2022
0.3.0 Jul 31, 2022
0.2.0 Jul 31, 2022

#1115 in Filesystem

Download history 24/week @ 2024-02-26 1/week @ 2024-03-11 75/week @ 2024-04-01

75 downloads per month

MIT license

14KB
243 lines

gitcp

test

Copy files from Git repository to local.

Install

We are planning to add some installers support in the future.

e.g.

  • homebrew
  • winget
  • debian package
  • etc.

For now, manually install prebuilt binary from GitHub Releases page:

or install from source via:

cargo install gitcp

Usage

$ gitcp --help
gitcp 0.3.1
Copy files from Git repository to local.

USAGE:
    gitcp <source> [destination]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

ARGS:
    <source>         GitHub repository name (e.g. r7kamura/gitcp)
    <destination>    Path to destination directory [default: .]

Copy all files

Copy all files from https://github.com/owner/repo to current directory.

gitcp owner/repo

Copy all files into specific directory

gitcp owner/repo tmp/repo

Copy all files from specific ref

gitcp owner/repo@v1

Copy specific file

gitcp owner/repo/foo.txt

Copy specific files

You can specify globwalk powered glob patterns.

gitcp owner/repo/{foo,bar}.*

Configuration

.gitcpignore

If there is .gitcpignore in the copied repository side, it will be used to ignore files.

# .gitcpignore
CHANGELOG.md
README.md

Usecase

This tool can be used not only to simply copy files from any repository, but also as an installer to provide templates for custom GitHub actions.

This is an example to install github-label-sync-action into the repository:

gitcp r7kamura/github-label-sync-action-template

If you always prepare routine files every time you create a repository, I think you can make it easier with gitcp by preparing that template.

Dependencies

~13–31MB
~477K SLoC