A lightweight CLI to fetch individual files from remote Git repositories and track them locally for reproducibility.
⚠️ NOT YET PUBLISHED TO NPM This package is pending its initial npm release. Until then, use the local testing methods below to try it out.
The package is not yet available on npm. Here's how to test it locally:
Test the tool as if it were installed from npm:
# Clone and setup
git clone https://github.com/arkahna/git-file-fetch.git
cd git-file-fetch
pnpm install
pnpm build
npm link
# Now use from anywhere on your system
git-file-fetch "https://github.com/octokit/core.js.git@main:LICENSE"
# To unlink later
npm unlink -g @arkahna-npm/git-file-fetchQuick testing during development:
# Clone and setup
git clone https://github.com/arkahna/git-file-fetch.git
cd git-file-fetch
pnpm install
pnpm build
# Using built version
node dist/index.js "https://github.com/octokit/core.js.git@main:LICENSE" --dry-run
# Or run TypeScript directly (no build needed)
pnpm start "https://github.com/octokit/core.js.git@main:LICENSE" --dry-runMost realistic test of the published package:
# In git-file-fetch directory
pnpm install
pnpm pack
# Creates: arkahna-npm-git-file-fetch-0.1.0.tgz
# In your test project
npm install /path/to/git-file-fetch/arkahna-npm-git-file-fetch-0.1.0.tgz
npx git-file-fetch "https://github.com/user/repo.git@main:file.ts"npx @arkahna-npm/git-file-fetch "https://github.com/user/repo.git@main:path/to/file.ts"npm install -D @arkahna-npm/git-file-fetch
npx @arkahna-npm/git-file-fetch "https://github.com/user/repo.git@main:path/to/file.ts"git clone https://github.com/arkahna/git-file-fetch.git
cd git-file-fetch
pnpm install
pnpm buildAvailable development commands:
pnpm build- Build the projectpnpm typecheck- Run TypeScript type checkingpnpm lint:check- Run ESLint checkspnpm lint:fix- Run ESLint with auto-fixpnpm lint:md- Run Markdown lint checkspnpm lint:md:fix- Run Markdown lint with auto-fixpnpm test:smoke- Run smoke test
- 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
- 🚀 Getting Started - Complete setup guide
- 📖 Usage Guide - CLI options and examples
- ⚙️ Configuration - Advanced setup
- 🔧 Troubleshooting - Common issues
- 🚀 CI Integration - CI/CD workflows and automation
- 🛣️ Roadmap - Development plans
- 🤝 Contributing - How to contribute
- 🔒 Security - Security policies
- 📋 Code of Conduct - Community guidelines
- Git available on your PATH
- Node.js >= 22 (supports 22, 23, 24)
MIT © Arkahna
Originally contributed by Aneki
_ _
__ _ _ __ ___| | _(_)
/ _` | '_ \ / _ \ |/ / |
| (_| | | | | __/ <| |
\__,_|_| |_|\___|_|\_\_|
=== ᚢ · ᚦ · ᚲ ===