npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@magarcia/gitingest

v1.1.0

Published

A tool to turn any Git repository into a simple text digest of its codebase.

Readme

Git Ingest

Turn any Git repository into a simple text digest of its codebase.

This is useful for feeding a codebase into any LLM.

Inspired by gitingest.com

Features

  • Extracts text content from all files in a git repository
  • Generates a tree structure of the repository
  • Respects .gitignore rules
  • Supports additional ignore patterns via --ignore flag
  • Automatically detects and skips binary files
  • Provides clear file separation in output
  • Supports multiple repository input formats:
    • Local directory
    • Git URLs (HTTPS and SSH)
    • GitHub web URLs (with branch support)
    • GitLab web URLs (with branch support)
  • Optional clipboard support
  • Built-in help with examples (--help)
  • Cross-platform support (Windows, macOS, Linux)
  • Written in TypeScript with full type safety

Requirements

  • Node.js >= 12.0.0
  • Git installed and available in PATH

Installation

npm install -g @magarcia/gitingest

Usage

Once installed, the tool can be executed as git ingest.

Basic Usage

# Show help and available options
git ingest --help

# Process current directory
git ingest

# Process specific local directory
git ingest /path/to/repo

# Copy output to clipboard instead of printing
git ingest -c
git ingest --copy

# Ignore specific files or patterns
git ingest --ignore "*.log"
git ingest --ignore "temp/*" --ignore "docs/*.md"

Remote Repositories

The tool supports various repository URL formats:

# GitHub URLs
git ingest https://github.com/username/repo
git ingest https://github.com/username/repo/tree/branch

# GitLab URLs
git ingest https://gitlab.com/username/repo
git ingest https://gitlab.com/username/repo/-/tree/branch

# Direct Git URLs
git ingest [email protected]:username/repo.git
git ingest https://github.com/username/repo.git

# With ignore patterns
git ingest https://github.com/username/repo --ignore "*.test.js" --ignore "dist/*"

When using a remote repository URL:

  1. The repository is cloned to a temporary directory
  2. Content is extracted
  3. Temporary directory is automatically cleaned up

Ignore Patterns

The tool supports ignoring files and directories using glob patterns:

# Ignore all log files
git ingest --ignore "*.log"

# Ignore multiple patterns
git ingest --ignore "temp/*" --ignore "docs/*.md"

# Ignore test files in any directory
git ingest --ignore "**/*.test.js"

Ignore patterns:

  • Can be specified multiple times with --ignore
  • Use the same glob syntax as .gitignore
  • Are applied in addition to existing .gitignore rules
  • Affect both content extraction and tree structure

Output Format

The tool generates two main sections:

  1. Repository Tree Structure: A visual representation of the repository's file structure
  2. Repository Content: The actual content of text files

Example output:

Repository Tree Structure:
├── src
│   ├── index.ts
│   └── utils.ts
├── package.json
└── README.md

Repository Content:
File: src/index.ts
[content...]

File: src/utils.ts
[content...]

API

The package also exports functions that you can use in your own code:

import { extractRepositoryContent } from '@magarcia/gitingest';

// Extract content from a local repository
const { content, tree } = extractRepositoryContent('/path/to/repo');
console.log('Tree structure:', tree);
console.log('Content:', content);

Functions

extractRepositoryContent(repoPath: string): { content: string, tree: string }

Extracts text content and tree structure from a local git repository.

  • repoPath: Path to the local git repository
  • Returns an object with:
    • content: Concatenated text content from all files
    • tree: Visual tree structure of the repository

Development

To contribute to this project, please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Make your changes.
  4. Submit a pull request.

Prerequisites

  • Node.js (v14 or later)
  • npm or yarn

Setup

  1. Clone the repository
  2. Install dependencies:
    npm install

Scripts

  • npm run build - Builds the TypeScript code
  • npm run dev - Runs the tool in development mode

Contributing

  1. Fork the repository
  2. Create your feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a new Pull Request

License

MIT