{"slug": "how-to-give-chatgpt-your-whole-codebase-in-one-file-with-repomix", "title": "How to give ChatGPT your whole codebase in one file with Repomix", "summary": "Repomix, an open-source tool from developer yamadashy, packs an entire repository into a single AI-friendly file that can be uploaded to ChatGPT, Claude or Gemini for code review and architecture questions. The CLI respects .gitignore, counts tokens per file and per repo using the o200k_base tokenizer, scans for secrets with Secretlint, and can compress code to its structure via Tree-sitter. It also supports glob include/ignore filters, output splitting, remote GitHub repos, and optional git log and diff context.", "body_md": "ChatGPT is good at reviewing code, explaining an unfamiliar project and writing tests. It is bad at guessing what is in the 40 files you did not paste. Copying files one by one is slow, you lose the folder structure, and you never know how close you are to the context limit.\n\n[Repomix](https://github.com/yamadashy/repomix) packs an entire repository into a single AI-friendly file with one command. It respects your `.gitignore`, counts tokens per file and for the whole repo, scans for secrets with Secretlint so credentials stay out of the output, and can compress code down to its structure with Tree-sitter. You then upload that one file to ChatGPT, Claude, Gemini or any other model.\n\nThis guide walks through the workflow end to end.\n\nYou do not even need to install it. In your project folder:\n\n```\nnpx repomix@latest\n```\n\nIf you will use it often, install it once. On a Mac, Homebrew works:\n\n```\nbrew install repomix\n```\n\nnpm (`npm install -g repomix`), yarn and bun work too. Then just run:\n\n```\nrepomix\n```\n\nRepomix writes `repomix-output.xml` to the current folder: a file summary, the directory structure and every file's contents. The terminal output shows the token count and your five largest files, so you know before uploading whether it will fit.\n\nUpload `repomix-output.xml` to a ChatGPT chat (or paste it if it is small) and start with a prompt like the one the README suggests:\n\n```\nThis file contains all the files in the repository combined into one.\nI want to refactor the code, so please review it first.\n```\n\nWant to skip the upload? `--copy` puts the output straight on your clipboard:\n\n```\nrepomix --copy\n```\n\nBig repos are where most people give up. Repomix has four levers for this.\n\n**Pack only what matters.** Use glob patterns to include or ignore paths:\n\n```\nrepomix --include \"src/**/*.ts,**/*.md\"\nrepomix --ignore \"**/*.log,tmp/\"\n```\n\n**Compress.** `--compress` uses Tree-sitter to keep the essential structure (classes, functions, interfaces) and drop the rest. Great for \"explain the architecture\" questions where the model does not need every line:\n\n```\nrepomix --compress\n```\n\n**Strip noise.** `--remove-comments` and `--remove-empty-lines` cut tokens further.\n\n**Split it.** If a pack is still too big for one upload, `--split-output` writes numbered files of a size you choose:\n\n```\nrepomix --split-output 2mb\n```\n\nTo find the heavy folders first, `--token-count-tree` prints your file tree with token counts. The default counting uses the `o200k_base` tokenizer, which the README lists as GPT-4o's, and you can change it with `--token-count-encoding`.\n\nXML is the default. You can also ask for Markdown, JSON or plain text:\n\n```\nrepomix --style markdown\n```\n\nMarkdown is easy to skim yourself before you upload. JSON is useful if you want to query the pack with `jq`.\n\nThis is the underrated feature. Want ChatGPT to explain a library before you adopt it? Point Repomix at the repo:\n\n```\nrepomix --remote yamadashy/repomix\n```\n\nIt accepts full GitHub URLs, the `user/repo` shorthand, and a branch, tag or commit with `--remote-branch`. Combine it with compression for a quick architecture overview:\n\n```\nrepomix --remote yamadashy/repomix --compress\n```\n\nThen use the README's library overview prompt:\n\n```\nThis file contains the entire codebase of library. Please provide a comprehensive overview of the library, including its main purpose, key features, and overall architecture.\n```\n\nFor security, Repomix does not load config files from remote repos unless you pass `--remote-trust-config`.\n\nWhen you are asking \"why did this break?\", recent changes matter more than the full source. Repomix can add git context:\n\n```\nrepomix --include-logs --include-diffs\n```\n\n`--include-logs` adds the last 50 commits by default, with dates, messages and changed files. `--include-diffs` adds your working tree and staged changes.\n\nThe README ships a few prompts you can paste after uploading:\n\nOnce you find flags you like, write them to a config file so every run uses them:\n\n```\nrepomix --init\n```\n\nThat creates `repomix.config.json` in the project. Add `--global` to make it your default everywhere.\n\nWe wrote up this workflow in a shorter form, with who it suits and where it falls down: [Repomix tutorial: pack your codebase into one file for an LLM](https://dedupedai.com/use-cases/yamadashy-repomix/pack-repo-into-one-file-for-llm/?utm_source=devto&utm_medium=article&utm_campaign=howto_repomix). The [Repomix repo page on Deduped](https://dedupedai.com/use-cases/yamadashy-repomix/?utm_source=devto&utm_medium=article&utm_campaign=howto_repomix) collects other ways people use it.\n\nIf your real goal is to understand a codebase you just inherited rather than chat about it, compare this with [how to map an unfamiliar codebase in one run with Graphify](https://dedupedai.com/use-cases/graphify-labs-graphify/map-unfamiliar-codebase-in-one-run/?utm_source=devto&utm_medium=article&utm_campaign=howto_repomix).\n\n*Deduped tracks the AI repos people are actually building with and writes up how to use them. Repo: [github.com/yamadashy/repomix](https://github.com/yamadashy/repomix).*\n\n**Get one email every Monday with the week's hottest AI repos and exactly how to use them: [subscribe free at dedupedai.com](https://dedupedai.com/join/?utm_source=devto&utm_medium=article&utm_campaign=howto_repomix)**", "url": "https://wpnews.pro/news/how-to-give-chatgpt-your-whole-codebase-in-one-file-with-repomix", "canonical_source": "https://dev.to/dedupedai/how-to-give-chatgpt-your-whole-codebase-in-one-file-with-repomix-20l9", "published_at": "2026-10-29 00:29:15+00:00", "updated_at": "2026-10-29 00:41:44.480363+00:00", "lang": "en", "topics": ["ai-tools", "developer-tools", "large-language-models", "ai-products"], "entities": ["Repomix", "yamadashy", "ChatGPT", "Claude", "Gemini", "Secretlint", "Tree-sitter", "GitHub"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/how-to-give-chatgpt-your-whole-codebase-in-one-file-with-repomix", "markdown": "https://wpnews.pro/news/how-to-give-chatgpt-your-whole-codebase-in-one-file-with-repomix.md", "text": "https://wpnews.pro/news/how-to-give-chatgpt-your-whole-codebase-in-one-file-with-repomix.txt", "jsonld": "https://wpnews.pro/news/how-to-give-chatgpt-your-whole-codebase-in-one-file-with-repomix.jsonld"}}