Skip to main content

Inject git and GitHub repos as markdown for LLM and AI Agents context

Project description

repo-to-md

PyPI version
Python versions

repo-to-md turns any repo or just a part of it into a single Markdown with a full file tree and the full contents of every source file. Binary files, images, build artifacts, and dependency lock-files are automatically excluded so you get a clean, copy-pastable context for:

  • providing context to AI coding assistants such as Claude Code (Anthropic), ChatGPT (OpenAI), GitHub Copilot, or deep-research agents;
  • code reviews, documentation, or quick sharing on forums and gists;
  • pasting snippets while staying under model token limits.

Table of contents

Features

  • Remote or local - works with owner/repo, /local/path/repo, full Git URLs and more.
  • Selective output - include (-i) and exclude (-e) any number of paths or globs like src/, tests/*, README.md.
  • Smart filtering - skips binary blobs, media, archives, and dozens of lock files automatically.
  • Pure-Python - no system-level dependencies, runs everywhere Python does.
  • Supports Python 3.10 and newer - published on PyPI.

Installation

The project is distributed on PyPI, so any modern Python installer will work.
If you already use the excellent uv tool, a single command is enough:

To run repo-to-md one time, without installing it, use uvx:

# Run one time using uvx
uvx repo-to-md github/repo > repo.md

Or install it globally:

# Install
uv tool install repo-to-md
# Run it
repo-to-md github/repo > repo.md

Of course, you can also use pip if you prefer.

# Install
pip install repo-to-md
# Run it
repo-to-md github/repo > repo.md

Supported platforms

  • macOS, Linux, Windows
  • Python ≥ 3.10 (see badge above)

Usage

Entire GitHub repo into a single hello-world.md file.

repo-to-md octocat/Hello-World > hello-world.md

Local repo but only files inside the src/ folder.

repo-to-md ~/Projects/myapp -i src/ > myapp_src.md

Print contents of just the pyproject.toml file alone:

repo-to-md . -i pyproject.toml

The first positional argument is either a GitHub repo or a local path.
Selectively include or exclude files/directories with -i/--include and -e/--exclude.

Copy to clipboard

  • macOS: repo-to-md . | pbcopy (paste with ⌘V)
  • Linux / X11: repo-to-md . | xclip -selection clipboard
  • Windows / PowerShell: repo-to-md . | clip

Replace . with any path or GitHub repo, and feel free to include src/ or similar after it.

With Claude Code

Best way to use it inside Claude Code is to ask it to dump the repo into a Markdown file and then work with that file.

Bash(repo-to-md github/repo > repo.md)

Alternatively, you can just output the entire repo into current context:

Bash(repo-to-md github/repo)

You can even invoke it without Bash and Claude will understand you.

repo-to-md github/repo

Contributing & License

Issues and pull requests are welcome. Licensed under the Apache-2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

repo_to_md-0.1.0.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

repo_to_md-0.1.0-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file repo_to_md-0.1.0.tar.gz.

File metadata

  • Download URL: repo_to_md-0.1.0.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.16

File hashes

Hashes for repo_to_md-0.1.0.tar.gz
Algorithm Hash digest
SHA256 65b767cfdd8df47f7a869e986d543f76524b615a4930d6031c437fb23473794d
MD5 fed6ce2c368857a570ebcef828ec83c1
BLAKE2b-256 a7fdda120f1cfaf613c3dcdc4d20dc1384caaf0a7fa64f3341992f1cb5f54a60

See more details on using hashes here.

File details

Details for the file repo_to_md-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: repo_to_md-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.16

File hashes

Hashes for repo_to_md-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 99912866e07c247d528a87b103e03143a2d5df68f326c78e7d8838daaaca2e0e
MD5 b3e90fa2f5e0fc88eae8cb9b54a6584c
BLAKE2b-256 77353c73c7c1acc9a2b92c99acb1feafc8fd9d895bc8542f78dd7cdc2f59eb3a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page