flatten
May 26, 2025
Combine your entire codebase into a single Markdown file: https://github.com/brequet/flatten
When sharing code with LLMs or getting a quick overview of a project structure, I needed a simple way to bundle everything together. Flatten does exactly that - it walks through your project and outputs a single Markdown file with all your code.
How it works
Point it at a directory, and it collects all text files while respecting .gitignore rules. You can output either the full code dump or just a file tree. Custom include/exclude patterns let you focus on specific file types.
Installation
cargo install --git https://github.com/brequet/flatten Pre-built binaries are available in the releases.
Usage
flatten [OPTIONS] [INPUTS]... Flatten current directory:
flatten Print to stdout instead of file:
flatten --print Only include Rust files:
flatten -i "*.rs" Check the GitHub repository for full documentation and options.