|
1 | 1 | --- |
2 | 2 | title: "Gitingest: Convert GitHub Repos into AI-Ready Text Digests" |
3 | | -description: "Explore how Gitingest turns complex GitHub repositories into structured text digests that are perfect for AI models. Learn how to install, use via CLI or browser, and even self-host it with Docker." |
| 3 | +description: Gitingest turns a GitHub repo or local directory into a single LLM-ready text digest, with a summary, file tree, and token count. How it actually works, verified CLI flags and limits, and how it compares to Repomix and pasting files by hand. |
4 | 4 | author: oceanofanything |
5 | 5 | date: 2025-05-20 |
6 | | -tags: [ai tools, github, python, developer-tools, open-source, prompt engineering, ChatGPT, GitIngest, LLM Integration, Ingest, Digest, Context, Prompt, Git workflow, codebase extraction, Git repository, Git automation, Summarize, prompt-friendly, codebase analysis, GitHub integration, code summarization, Deep learning, machine learning, AI research, software development, code understanding, code analysis, software engineering, DeepSeek, Cloudflare, GitHub Copilot, github-actions, GitHub Pages, GitHub CLI, GitHub API, GitHub Desktop, GitHub Issues, GitHub Pull Requests, GitHub Marketplace, Manus AI, Anthropic, DeepSeek-R1, GPT-4.1, GPT-4o, Hugging Face, OpenAI] |
7 | 6 | categories: [AI, tools, news, github] |
8 | | -image: |
| 7 | +tags: [ai tools, developer-tools, github, python, open-source, GitIngest, LLM Integration, codebase analysis, code summarization, Git workflow, GitHub integration, docker, Python CLI tools, prompt engineering] |
| 8 | +image: |
9 | 9 | path: https://scriptxeno.github.io/2025-05-20-all-about-gitingest-images/2025-05-20-all-about-gitingest.webp |
10 | | - alt: "Banner Art By Nakshatra Ranjan Saha" |
| 10 | + alt: Banner Art By Nakshatra Ranjan Saha |
11 | 11 | lqip: data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== |
12 | 12 | --- |
| 13 | +# Gitingest: turning a GitHub repo into an LLM-ready text digest |
13 | 14 |
|
14 | | -Navigating large codebases just got easier! Meet **Gitingest** — the open-source tool that transforms any GitHub repository into a clean, LLM-ready digest. |
| 15 | +Getting a language model to reason about a whole codebase usually starts with a manual, repetitive step: open a file, copy it, paste it into the chat, repeat for every module the model needs to see, and hope you did not skip the one config file that explains why the code is structured the way it is. Gitingest exists to remove that step. Point it at a local folder or a GitHub URL and it walks the repository, respects `.gitignore`, and hands back a single text file built from a summary, a directory tree, and the contents of every file it included, formatted so a model can read the whole thing in one prompt. |
15 | 16 |
|
16 | | ---- |
| 17 | +### Quick answer |
17 | 18 |
|
18 | | -## 💼 Personal Story |
| 19 | +Gitingest is an open source Python tool, usable as a CLI, a Python library, or a hosted web app at [gitingest.com](https://gitingest.com), that converts a Git repository or local directory into one text digest for feeding to an LLM. It is MIT licensed, actively maintained under the [coderamp-labs/gitingest](https://github.com/coderamp-labs/gitingest) organization on GitHub (the project started under maintainer Romain Courtois's `cyclotruc` handle, and the old URL still redirects there), and has passed 15,000 GitHub stars as of September 2026. Install it with `pip install gitingest` or `pipx install gitingest`, or skip installing anything at all and just replace `github` with `ingest` in any GitHub repository URL to get the same digest in your browser. |
19 | 20 |
|
20 | | -It was a late night, and I was just busy and tired of coding and debugging. I had a huge project was pending, and I didn't had the energy to read through the entire codebase of GitHub repo. |
| 21 | +### What it actually does |
21 | 22 |
|
22 | | -I was using ChatGPT to help me with the code, but I was still struggling to get the right context. Every time I asked it about a specific part of the code, it would take a while to understand the context. And most of the time, the memory was limited to the last few lines of code. |
| 23 | +The core trick is the URL swap: `github.com/coderamp-labs/gitingest` becomes `gitingest.com/coderamp-labs/gitingest`, and you land on a page with the same three-part output the CLI produces locally. First a summary (repository name, number of files analyzed, and an estimated token count using `tiktoken`, so you know before you paste anything whether the digest will actually fit in your model's context window). Then a directory tree showing the repository's structure. Then the concatenated contents of every included file, each one preceded by its path so the model knows where in the project it is reading from. Running the CLI writes all three sections into one `digest.txt` by default, which is what you paste into a chat or hand to an agent. |
23 | 24 |
|
24 | | -Then I Found **Gitingest**. It was a game-changer! I could just point it to the GitHub repo, and it would give me a clean, structured digest of the entire codebase. No more scrolling through endless lines of code or trying to explain the context to ChatGPT. |
| 25 | +### Installing it |
25 | 26 |
|
26 | | -I could just copy and paste the digest into ChatGPT, and it would understand everything perfectly. It saved me so much time and effort, and I was finally able to focus on the actual coding instead of getting lost in the details. |
| 27 | +```bash |
| 28 | +pip install gitingest |
| 29 | +# or, for an isolated CLI install |
| 30 | +pipx install gitingest |
| 31 | +# adds the extras needed to run the local web UI yourself |
| 32 | +pip install gitingest[server] |
| 33 | +``` |
27 | 34 |
|
28 | | -I was so impressed with Gitingest that I decided to share it with my friends and colleagues. They were equally amazed by how easy it made working with large codebases. It felt like having a personal assistant who could summarize everything for you. |
| 35 | +`pipx` is worth using over plain `pip` for a command-line tool like this since it keeps Gitingest's dependencies out of whatever Python environment you happen to be in when you run it. |
29 | 36 |
|
30 | | -## 🚀 What is Gitingest? |
| 37 | +### CLI usage, verified against the current flags |
31 | 38 |
|
32 | | -**Gitingest** simplifies the process of understanding and summarizing code from Git repositories. With a single command or link edit, developers and AI researchers can get a clean, prompt-ready version of any repo. |
| 39 | +The flags in a lot of Gitingest writeups online (including the earlier version of this post) are stale. Checked directly against the CLI source as it stands today: |
33 | 40 |
|
34 | | -### 🔍 Key Highlights |
| 41 | +```bash |
| 42 | +# current directory, writes ./digest.txt |
| 43 | +gitingest . |
35 | 44 |
|
36 | | -- **LLM-Friendly Output**: Converts code into structured, readable text ideal for large language models. |
37 | | -- **Effortless Access**: Replace `github` with `ingest` in any GitHub URL to view the digest. |
38 | | -- **Stats and Insights**: See file structure, extract size, and token count. |
39 | | -- **Multiple Interfaces**: Use via CLI, browser extensions, or Python. |
40 | | -- **Open Source**: Licensed under the MIT license. |
| 45 | +# a full GitHub repo |
| 46 | +gitingest https://github.com/coderamp-labs/gitingest |
41 | 47 |
|
42 | | ---- |
| 48 | +# just one subdirectory of a repo |
| 49 | +gitingest https://github.com/coderamp-labs/gitingest/tree/main/src/gitingest |
43 | 50 |
|
44 | | -## 🛠️ Installation |
| 51 | +# exclude and include shell-style glob patterns (repeatable flags) |
| 52 | +gitingest . -e "*.md" -e "node_modules/*" -i "*.py" |
45 | 53 |
|
46 | | -Install Gitingest using pip: |
| 54 | +# raise the per-file size cap past the 10 MB default, in bytes |
| 55 | +gitingest . -s 50000000 |
47 | 56 |
|
48 | | -```bash |
49 | | -pip install gitingest |
50 | | -```` |
| 57 | +# print to stdout instead of writing digest.txt |
| 58 | +gitingest . -o - |
51 | 59 |
|
52 | | ---- |
| 60 | +# a private repo, via a token flag or the GITHUB_TOKEN env var |
| 61 | +gitingest https://github.com/you/private-repo -t ghp_yourtoken |
| 62 | +``` |
53 | 63 |
|
54 | | -## 🧪 Python Usage |
| 64 | +Two corrections worth flagging: the exclude flag is `-e` / `--exclude-pattern` (repeatable, not a single `--exclude`), and `-s` / `--max-size` takes a plain byte count, not a string like `100kb`. There's also a `-b` / `--branch` flag for pulling a specific branch, and an `--include-submodules` flag if the repo you're ingesting pulls in others. |
| 65 | + |
| 66 | +### Python usage |
55 | 67 |
|
56 | 68 | ```python |
57 | 69 | from gitingest import ingest |
58 | 70 |
|
59 | | -summary, tree, content = ingest("https://github.com/imanoop7/Ollama-OCR") |
| 71 | +summary, tree, content = ingest("https://github.com/coderamp-labs/gitingest") |
60 | 72 | ``` |
61 | 73 |
|
62 | | ---- |
| 74 | +For async code (Jupyter notebooks can `await` this directly): |
63 | 75 |
|
64 | | -## 💻 CLI Usage |
65 | | - |
66 | | -Analyze a local directory: |
| 76 | +```python |
| 77 | +import asyncio |
| 78 | +from gitingest import ingest_async |
67 | 79 |
|
68 | | -```bash |
69 | | -gitingest /path/to/directory |
| 80 | +summary, tree, content = asyncio.run(ingest_async("path/to/directory")) |
70 | 81 | ``` |
71 | 82 |
|
72 | | -Ingest a GitHub repo: |
| 83 | +Both return the same three strings the CLI writes to `digest.txt`, which is the more useful entry point if you're building something on top of Gitingest rather than running it once by hand, like a script that regenerates a digest every time a repo changes and hands it to an agent automatically. |
73 | 84 |
|
74 | | -```bash |
75 | | -gitingest https://github.com/cyclotruc/gitingest |
76 | | -``` |
| 85 | +### Where it falls over |
77 | 86 |
|
78 | | -💾 Output: Saves `digest.txt` in your current directory. |
79 | | - |
80 | | -{%raw%} |
81 | | -<script type="text/javascript"> |
82 | | - atOptions = { |
83 | | - 'key' : 'e790d6d5d53ad675ad53d13f5dcff8e8', |
84 | | - 'format' : 'iframe', |
85 | | - 'height' : 50, |
86 | | - 'width' : 320, |
87 | | - 'params' : {} |
88 | | - }; |
89 | | -</script> |
90 | | -<script type="text/javascript" src="https://wirelessbin.com/e790d6d5d53ad675ad53d13f5dcff8e8/invoke.js"></script> |
91 | | -{%endraw%} |
92 | | - |
93 | | ---- |
| 87 | +Gitingest has hard limits baked into its default configuration, and they matter more than the marketing copy on any tool's homepage usually admits: files over 10 MB are skipped unless you raise `--max-size`, it stops after 10,000 files, it will not walk more than 20 directories deep, and total output is capped at 500 MB. On an average app repo none of that matters. On a large monorepo, a repo with vendored dependencies checked in, or one with big binary or data files, you will need `--exclude-pattern` to keep the digest from either hitting those caps or producing a token count too large for any model's context window to hold anyway. The token estimate in the summary is the useful signal here: if it comes back at 400,000 tokens, that is Gitingest telling you the digest needs trimming, not a bug. |
94 | 88 |
|
95 | | -## 🌐 Browser Extensions |
| 89 | +### Gitingest versus doing it by hand, or with Repomix |
96 | 90 |
|
97 | | -Install directly via: |
| 91 | +Compared to manually copying files into a chat, Gitingest's advantage is completeness and speed: it walks the whole tree once, respects `.gitignore` so you are not pasting in `node_modules`, and tells you the token count up front instead of finding out mid-conversation that the model lost track of an earlier file. |
98 | 92 |
|
99 | | -- [Chrome Web Store](https://chrome.google.com/webstore/) |
100 | | -- [Firefox Add-ons](https://addons.mozilla.org/) |
101 | | -- [Edge Add-ons](https://microsoftedge.microsoft.com/addons/) |
| 93 | +The closest alternative worth knowing about is [Repomix](https://github.com/yamadashy/repomix), a Node-based tool that does the same job with more output format options (XML, Markdown, or plain text, versus Gitingest's single text format) and a built-in remote MCP server, so an agent can call it directly rather than you running it as a separate step. Gitingest's edge is the zero-install path: the `gitingest.com` URL swap and a [Chrome extension](https://chromewebstore.google.com/detail/gitingest-turn-any-git-re/adfjahbijlkjfoicpjkhjicpjpjfaood) that adds an "Ingest" button to GitHub's own repo pages, so you never have to open a terminal at all. Which one to reach for mostly comes down to your stack and whether you want the output piped straight into an agent's tool calls or pasted by hand. |
102 | 94 |
|
103 | | ---- |
| 95 | +This is the same underlying problem this blog's own tooling deals with, just solved for a different audience. The [MCP server behind this blog](https://scriptxeno.github.io/posts/how-i-run-this-blog-claude-code-mcp-server/) exists so Claude Code always has structured, current context about this specific repo instead of stale or partial file contents; Gitingest is a much more general version of the same idea, aimed at any repo you have not built custom tooling for. If you are running an agent like [OpenCode](https://scriptxeno.github.io/posts/opencode-open-source-ai-agent/) against a codebase it has not seen before, generating a digest first and dropping it into the agent's initial context is a fast way to give it the shape of the project before it starts making changes. |
104 | 96 |
|
105 | | -## 🐳 Self-Hosting with Docker |
| 97 | +### Self-hosting with Docker |
106 | 98 |
|
107 | 99 | ```bash |
108 | | -git clone https://github.com/cyclotruc/gitingest.git |
| 100 | +git clone https://github.com/coderamp-labs/gitingest.git |
109 | 101 | cd gitingest |
110 | 102 | docker build -t gitingest . |
111 | 103 | docker run -d --name gitingest -p 8000:8000 gitingest |
112 | 104 | ``` |
113 | 105 |
|
114 | | -Access locally at: [http://localhost:8000](http://localhost:8000) |
115 | | - |
116 | | ---- |
| 106 | +That builds and runs the same web app gitingest.com serves, reachable at `http://localhost:8000`. Worth doing if you want the browser workflow for private or internal repos without sending anything to a third-party server, or if you just want the local web UI running from `pip install gitingest[server]` instead. |
117 | 107 |
|
118 | | -## ⚙️ Advanced CLI Options |
| 108 | +### Frequently asked questions |
119 | 109 |
|
120 | | -- Exclude specific files: |
| 110 | +**Is Gitingest free?** |
| 111 | +Yes. It is MIT licensed, the CLI and Python library are free to install and run, and the hosted version at gitingest.com is free to use. |
121 | 112 |
|
122 | | - ```bash |
123 | | - gitingest . --exclude *.md |
124 | | - ``` |
| 113 | +**Does it work on private repositories?** |
| 114 | +Yes, with a GitHub personal access token, either passed via `-t`/`--token` or set as the `GITHUB_TOKEN` environment variable. |
125 | 115 |
|
126 | | -- Limit file size: |
| 116 | +**Does my code get sent anywhere when I use it?** |
| 117 | +Only if you use the hosted gitingest.com version, which has to clone and process the repo on its own servers to build the digest. The CLI and Python library run entirely on your machine and never send anything out, so for private or sensitive code, install it locally instead of using the web version. |
127 | 118 |
|
128 | | - ```bash |
129 | | - gitingest . --max-size 100kb |
130 | | - ``` |
| 119 | +**How is this different from just cloning the repo and using `find` and `cat`?** |
| 120 | +It automates the parts that are tedious to script from scratch: respecting `.gitignore`, walking the tree in a consistent order, formatting each file with its path, and estimating the token count so you know upfront whether the result fits your model's context window. |
131 | 121 |
|
132 | | ---- |
| 122 | +**What's the real difference between Gitingest and Repomix?** |
| 123 | +Ecosystem and output flexibility, mainly. Gitingest is Python-based and outputs one text format; Repomix is Node-based, supports XML, Markdown, and plain text output, and ships a remote MCP server so an agent can call it as a tool directly instead of you running a CLI step first. |
133 | 124 |
|
134 | | -## 🎯 Why Use Gitingest? |
| 125 | +**Can Gitingest choke on a very large repository?** |
| 126 | +It has real caps: a 10 MB per-file limit by default, a 10,000 file limit, a 20-level directory depth limit, and a 500 MB total output limit. On a large monorepo you will likely need `--exclude-pattern` to stay under those and to keep the resulting token count usable. |
135 | 127 |
|
136 | | -Whether you're analyzing open-source projects, training AI, or streamlining team collaboration, Gitingest offers: |
137 | | -
|
138 | | -- Time-saving summaries |
139 | | -- Enhanced code understanding |
140 | | -- AI optimization |
141 | | -
|
142 | | ---- |
143 | | -
|
144 | | -## 🔗 Useful Links |
145 | | -
|
146 | | -- **Official GitHub**: [github.com/cyclotruc/gitingest](https://github.com/cyclotruc/gitingest) |
147 | | -- **Author’s GitHub**: [github.com/davidesantangelo](https://github.com/davidesantangelo) |
148 | | -- **LinkedIn**: [Anoop Maurya](https://www.linkedin.com/in/anoop-maurya-908499148) |
149 | | -- **Twitter**: [@imanoop\_7](https://x.com/imanoop_7) |
150 | | -
|
151 | | ---- |
| 128 | +### Sources |
152 | 129 |
|
153 | | -📣 *Give it a try and redefine how you engage with codebases!* |
| 130 | +- [Gitingest on GitHub](https://github.com/coderamp-labs/gitingest) |
| 131 | +- [Gitingest README](https://github.com/coderamp-labs/gitingest/blob/main/README.md) |
| 132 | +- [Gitingest CLI source (`__main__.py`)](https://github.com/coderamp-labs/gitingest/blob/main/src/gitingest/__main__.py) |
| 133 | +- [Gitingest config defaults (`config.py`)](https://github.com/coderamp-labs/gitingest/blob/main/src/gitingest/config.py) |
| 134 | +- [gitingest.com](https://gitingest.com) |
| 135 | +- [GitHub discussion: comparison with Repomix and other similar tools](https://github.com/coderamp-labs/gitingest/discussions/268) |
| 136 | +- [Repomix on GitHub](https://github.com/yamadashy/repomix) |
| 137 | +- [Gitingest Chrome extension on the Chrome Web Store](https://chromewebstore.google.com/detail/gitingest-turn-any-git-re/adfjahbijlkjfoicpjkhjicpjpjfaood) |
0 commit comments