git-diff-copy
v1.0.1
Published
A cross-platform CLI tool to export modified files between two git commits while preserving directory structure.
Downloads
281
Readme
git-diff-copy (gdc)
A cross-platform CLI tool that copies files changed between two git commits into a destination folder while preserving the original directory structure.
Useful for creating patch archives, deployment packages, or auditing changes between specific versions of your project.
Features
- 📂 Preserves Directory Structure: Keeps files in their original relative paths.
- 🚀 Cross-Platform: Works on Windows, macOS, and Linux.
- 🌳 Git Aware: Validates git repository and commit hashes.
- 🛡️ Safe: Checks for file existence before copying (handles deleted files gracefully).
- ⚙️ Zero Config: Helper interaction guides you through the process.
Installation
Install globally via npm:
npm install -g git-diff-copyOr run via npx without installation:
npx git-diff-copyUsage
- Open your terminal in a git repository.
- Run the command:
gdc - Follow the interactive prompts:
- Destination folder name: Where to copy the files (e.g.,
dist-patch,deploy-v2). - First git commit hash: The starting point (older commit/base).
- Second git commit hash: The ending point (newer commit/head).
- Destination folder name: Where to copy the files (e.g.,
Example
$ gdc
Destination folder name: my-patch
First git commit hash: a1b2c3d
Second git commit hash: e5f6g7h
Analyzing changes between a1b2c3d and e5f6g7h...
Found 3 changed file(s).
Success! Copied 3 files to:
/path/to/repo/my-patchLicense
ISC
