Skip to content

joshuaboys/git-file-fetch

git-file-fetch

CI npm version license: MIT node >= 22

A lightweight CLI to fetch individual files from remote Git repositories and track them locally for reproducibility.

Quick Start

Just want to use it?

npx git-file-fetch "https://github.com/user/repo.git@main:path/to/file.ts"

Want to install it?

npm install -D git-file-fetch
npx git-file-fetch "https://github.com/user/repo.git@main:path/to/file.ts"

Want to contribute/develop?

git clone https://github.com/joshuaboys/git-file-fetch.git
cd git-file-fetch
pnpm install
pnpm build

Available development commands:

  • pnpm build - Build the project
  • pnpm typecheck - Run TypeScript type checking
  • pnpm lint - Run ESLint with auto-fix
  • pnpm test:smoke - Run smoke test

What it does

  • Shallow Fetch: Performs a shallow fetch of the target ref without a full clone
  • File Extraction: Reads the file at that specific commit using git show
  • Local Copy: Copies the requested file(s) into your current working directory
  • Manifest Update: Writes an entry for each fetched file to a manifest for tracking provenance

Documentation

Requirements

  • Git available on your PATH
  • Node.js >= 22

License

MIT © Joshua Boys

Author

Created by Joshua Boys

                  _    _
  __ _ _ __   ___| | _(_)
 / _` | '_ \ / _ \ |/ / |
| (_| | | | |  __/   <| |
 \__,_|_| |_|\___|_|\_\_|

  === ᚢ · ᚦ · ᚲ ===

About

A lightweight CLI to fetch individual files from remote Git repositories and track them locally for reproducibility.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors