Once your project is shortlisted, you clean the repository and its git history before we pay, using the free scripts on this page. Then you export the archive yourself, and payment is released on a call once we've verified it.
We contact you once your project is shortlisted and a price is agreed.
You back up the repo, then clean every branch and tag and force-push them back in place, following the steps below.
You submit the form with your name, the check-repo.sh report for the cleaned repo and the .tar.gz archive you exported.
On a call, we verify the archive you uploaded in the form.
Once the archive passes our checks, payment is released on the call.
These steps take your repo from where it is today to a cleaned repository, every branch and tag, ready for export. Enter your GitHub username and repository name and every command below fills them in. Make the backup in step 01 before anything else.
Use this section to generate the exact commands and scripts for your repo, then copy them from here. Don't run things by hand from memory or from another guide: the steps and flags have to match, and doing it differently can mean redoing the work.
You can also paste the full repo URL into either field. On GitLab or Bitbucket, swap github.com for your host after copying.
Before anything else, copy the whole repository (every branch, tag and pull request ref) to a folder outside your project. The clean-up later overwrites your branches on GitHub, and this copy is the only way back. Keep it until the sale is done, and never push it anywhere: it holds the old history, secrets included.
mkdir -p ~/sale-backup
git clone --mirror https://github.com/{github-username}/{repo-name}.git ~/sale-backup/{repo-name}-backup.git
# Or as one file, from your own clone (fetch first so every branch is in it):
cd path/to/{repo-name} && git fetch --all --tags
git bundle create ~/sale-backup/{repo-name}.bundle --all
git bundle verify ~/sale-backup/{repo-name}.bundleChecklist: 01
You need git, Python 3, git-filter-repo and cloc. On Windows, use Git Bash or WSL.
# macOS
brew install git-filter-repo cloc
# Linux
sudo apt install git-filter-repo cloc # or: pip install git-filter-repo
# Then download the scripts into one folder
mkdir sale-tools && cd sale-tools
curl -O https://xephas.me/code/check-repo.sh
curl -O https://xephas.me/code/clean-history.sh
curl -O https://xephas.me/code/secrets.example.txtThe clean-up rewrites every branch. A pull request that is still open when its branch is rewritten can close itself or show a diff that makes no sense. Merge or close every open one first. Merged and closed pull requests keep their record, reviews and comments.
# With the GitHub CLI, or open the Pull requests tab
gh pr list --repo {github-username}/{repo-name} --state open
https://github.com/{github-username}/{repo-name}/pullsChecklist: 02
Take a fresh, full copy of what is on GitHub; checking it changes nothing. The report starts with a line per branch and tag, then lists every file and string that needs to go, with counts. The export ships every branch and tag, so every one of them has to pass.
git clone --mirror https://github.com/{github-username}/{repo-name}.git {repo-name}.git
bash check-repo.sh {repo-name}.git | tee before.txtWrite both at the root of your default branch, by hand from the template or with the AI prompts further down this page, review them and commit. Then put the same commit on every other branch: every branch ships, so each branch tip needs them. Push every branch. Do this before you clean, so the files are part of the cleaned history. A new owner must be able to build and run the project from run_instruction.md alone.
AI prompts for both filescd path/to/{repo-name}
git switch main
# write run_instruction.md and FEATURES.md, then:
git add run_instruction.md FEATURES.md
git commit -m "Add run instructions and feature list"
git push origin main
# Then on each other branch, one at a time:
git switch <branch>
git cherry-pick main # or: git merge main
git push origin <branch>Checklist: 09
Cancel and reissue every API key, token and password the report found, so the old values are dead. Then copy secrets.example.txt to secrets.txt and add one rule per secret or piece of personal data, real value ==> placeholder.
cp secrets.example.txt secrets.txt
# edit secrets.txt, one rule per line:
# sk_live_51Hxxxx==>YOUR_STRIPE_SECRET_KEY
# jane.doe@gmail.com==>user@example.comList the files and folders to remove from every commit: the ones the report flagged. AI tooling, .DS_Store, machine files and home paths are removed automatically. It works on a fresh copy of every branch and tag; a dry run shows what would go and changes nothing.
DRY_RUN=1 SECRETS_FILE=secrets.txt bash clean-history.sh \
https://github.com/{github-username}/{repo-name}.git .env android/app/build/ '*.jks' seed-data/Run it again without DRY_RUN. It rewrites every branch and tag in one pass, on a copy named after your repo (your-repo-clean.git), never on your repo. Every commit stays, with its message, author and date; only the commit IDs change. Repeat until it passes.
SECRETS_FILE=secrets.txt bash clean-history.sh \
https://github.com/{github-username}/{repo-name}.git .env android/app/build/ '*.jks' seed-data/clean-history.sh prints a line per branch and tag and re-runs check-repo.sh on the copy. Every branch and tag must show its messages, authors and dates as identical; in the check's table every count must be 0 on every row, and run_instruction.md must be on every branch. Run the check again yourself if you change anything.
bash check-repo.sh {repo-name}-clean.git | tee after.txtThis replaces each branch and tag on GitHub with its cleaned version, and your pull requests stay attached to the repo. clean-history.sh prints one line per branch and tag, each pinned to the commit GitHub holds now, so a push fails instead of overwriting something that changed. Run the first line alone and check it, then the rest. Then delete any backup or pre-clean branches from GitHub, since the export ships every branch. After this, every existing clone is stale: you and every collaborator must re-clone, and a git pull would merge the old history back in.
You can't undo this on GitHub. Make sure the backup from step 01 exists and opens before you push.
# What GitHub holds now
git ls-remote --heads --tags https://github.com/{github-username}/{repo-name}.git
# One line per branch and tag (clean-history.sh prints them all), e.g.:
git -C {repo-name}-clean.git push --force-with-lease=refs/heads/main:<current-sha> \
https://github.com/{github-username}/{repo-name}.git refs/heads/main:refs/heads/main
# Delete backup branches from GitHub, if you made any there
git push https://github.com/{github-username}/{repo-name}.git --delete <backup-branch>Checklist: 11
Check a new fresh copy. When it reads RESULT: ready, keep the full report: it goes in the form. GitHub keeps a read-only ref for every pull request (refs/pull/<n>/head). It never rewrites them, you can't delete them, and the export includes them, so they still hold each pull request's files from before the clean-up. Rotating every credential (step 06) makes any secret left there useless. Personal data there isn't fixed by rotation: check-repo.sh reports what those refs hold in section [10], and we decide together on the handover call.
git clone --mirror https://github.com/{github-username}/{repo-name}.git check.git
bash check-repo.sh check.git | tee report.txt
git ls-remote https://github.com/{github-username}/{repo-name}.git 'refs/pull/*' | tee pull-refs.txtWork through every item on your repository: the current files and the git history. Anything ever committed ships with the sale, and deleting a file today doesn't remove it from older commits. check-repo.sh finds every problem below, and clean-history.sh fixes them on a copy. Your ticks are saved in this browser.
A mirror clone or a bundle of every branch, tag and pull request ref, kept in a folder outside the project until the sale is done. Never push it back to GitHub.
Done in step: 01
Before the rewrite. An open pull request whose branch is rewritten can close itself or show a broken diff. Merged and closed ones keep their record.
Done in step: 03
Remove only the file, never the whole .github/ folder: it also holds your CI workflows, which we want.
Done in steps: 04 · 07 · 08 · 09
Check (in a mirror clone): this must print nothing.
git rev-list --objects --branches --tags | awk '{print $2}' | grep -iE '(^|/)(CLAUDE\.md|AGENTS\.md|copilot-instructions\.md|\.cursorrules|\.clinerules)|(^|/)\.(cursor|claude|aider|windsurf|remember)/|llm-guides/'Rotate (cancel and reissue) every key that was ever committed, so the old copy in history, in your backup and in any pull request ref is dead. Firebase client config (AIza... in google-services.json or firebase_options.dart) is a public identifier and may stay. To replace a secret string but keep the file, list it in secrets.txt for clean-history.sh.
Replace it with obvious placeholders such as user@example.com. Personal data can't be rotated like a key, so it must be rewritten out of history. Sample data from third-party docs, like a number in a Stripe README, is fine.
Dependencies and generated files bloat the history and aren't your code.
Done in steps: 04 · 07 · 08 · 09
Find the biggest files ever committed on any branch or tag:
git rev-list --objects --branches --tags | git cat-file --batch-check='%(objectsize) %(rest)' | sort -rn | head -20These only work on your machine and break for anyone else.
Check: this must print 0.
git log -p --branches --tags | grep -cE '/Users/|/home/'Commit them on every branch before you rewrite history: every branch ships, so each branch tip needs them, and they must sit in the cleaned history. The AI prompts on this page write both from your actual code.
Done in step: 05
AI prompts for both filesRewrite with clean-history.sh (git-filter-repo). Every commit stays with its message, author and date; only the commit IDs change. Don't squash, and don't copy the files into a new repo with one "initial commit".
Push every branch and tag back to the same repo with the commands clean-history.sh prints. Then delete any backup or pre-clean branches from GitHub, since the export ships every branch. Tell every collaborator to re-clone: an old clone must not pull or push.
Done in step: 10
Check a new fresh copy of the whole repo. Paste the full report into the form. It must end with RESULT: ready. Review any warnings: some are fine, such as your own support email.
Done in step: 11
git clone --mirror https://github.com/{github-username}/{repo-name}.git check.git
bash check-repo.sh check.git | tee report.txt
git ls-remote https://github.com/{github-username}/{repo-name}.git 'refs/pull/*' | tee pull-refs.txtYour archive is made from the repo as it stands when you export it. Anything pushed after your check isn't checked, and the export ships every branch.
Done in step: 11
When every box is ticked: you submitthe form: your name, the report and your archive. We then verify the archive you exported on a call, and payment is released once it passes the checks.
Everything above gets the repo ready. The archive is what the sale delivers: one .tar.gz with the full commit history, plus the pull requests with their reviews and comments, which you make yourself with GitHub's Migration API or GitLab's project export. GitHub only exports repositories the caller owns (or an organisation Owner or Migrator), and GitLab needs the Maintainer role or higher. Do it once the checklist is done.
GitHub: you own the repository, or it's in an organisation where you are an Owner or have the Migrator role. GitLab: you have the Maintainer role or higher.
You create a token and run three API calls, below in brief. The export packs the whole repository: every branch, tag and pull request ref. Your branches and tags ship clean. The pull request refs ship as they are and may still hold pre-clean files (see below). Pull requests end up inside the archive as pull_requests_*.json. This delivers the full record.
A classic personal access token. Your own account: scopes repo and user. An organisation: repo and admin:org. Copy it straight away.
POST to /user/migrations (or /orgs/<YOUR_ORG_NAME>/migrations) and note the "id" in the reply: your MIGRATION_ID.
GET /user/migrations/<MIGRATION_ID> (or /orgs/<YOUR_ORG_NAME>/migrations/<MIGRATION_ID>) until "state" is "exported".
GET /user/migrations/<MIGRATION_ID>/archive (or /orgs/<YOUR_ORG_NAME>/migrations/<MIGRATION_ID>/archive) to save the .tar.gz, or use the link GitHub emails you.
A user export works only for repositories your account owns. Collaborator access is rejected (typically 422 Validation Failed). For a repository in an organisation, you must be an Owner of the organisation or have the Migrator role. Otherwise, message us before you go further.
What the archive can still hold: GitHub never rewrites pull request refs (refs/pull/*), and the export includes them, so they keep each pull request's files from before the clean-up. You can't delete them. Rotating every credential (step 06) makes any secret there useless. Personal data there isn't fixed by rotation: send us what check-repo.sh reports in section [10] (step 11), and we decide together on the handover call.
# 1. Start (your account; organisations use /orgs/<YOUR_ORG_NAME>/migrations)
curl -L -X POST -H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR_TOKEN>" -H "X-GitHub-Api-Version: 2022-11-28" \
-d '{"lock_repositories":false, "repositories":["{github-username}/{repo-name}"]}' \
https://api.github.com/user/migrations
# 2. Repeat until "state" is "exported"
curl -L -H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR_TOKEN>" -H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/user/migrations/<MIGRATION_ID>
# 3. Download
curl -L -H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR_TOKEN>" -H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/user/migrations/<MIGRATION_ID>/archive -o {repo-name}.tar.gzrun_instruction.md travels inside the archive only if it is committed. Write it and commit it on every branch (step 05) before you clean the history and before anyone exports. If you add it afterwards, you redo the clean-up and the export. What it must cover.
The full guide, with screenshotsIncludes GitLab, organisation repositories, and how to verify the archive.
The sale includes the full git history, so anything that wasever committed ships with it, even if a later commit deleted it. Deleting a file or adding it to .gitignore doesn't remove it from history; only rewriting history does.
Free, plain bash, and readable before you run them. None of them pushes to your repo: clean-history.sh prints the push command for you to run yourself. They run on macOS and Linux, and on Windows through Git Bash or WSL.
Read-only audit of every branch and tag and their full history: a line per branch and tag, AI tooling files, secrets, personal data, build output, home-folder paths, run instructions, pull request refs and line count. Its report goes in the form.
Rewrites every branch and tag on a copy, never on your repo, keeping every commit with its author and date. It verifies each branch and tag, then prints the force-push commands for you to run.
Fill it in and save it as run_instruction.md at the root of your repo, on every branch: prerequisites, credentials, build/run/test commands, quick start, troubleshooting.
Example rules for replacing secret strings everywhere in your history while keeping the files that held them.
Paste into Claude Code, Cursor, Copilot or any AI coding assistant opened in your repo. It writes run_instruction.md from your actual code.
A required file at the root of the repo. Write it for a developer who has never seen your project and has none of your accounts, keys or machine setup. It must cover:
Every tool with the exact version you build with: Node 20, Flutter 3.24, Xcode 16.
Every placeholder you added, the file it lives in, and where a new owner gets their own value.
Exact commands for each part (app, web, API), run from the repo root.
The shortest path from a fresh clone to something running, in order.
The errors a new developer will hit first, and the fix for each.
Open your repo in an AI coding assistant (Claude Code, Cursor, GitHub Copilot or similar) and paste each prompt. It reads your actual code and writes the file, using only versions, commands and features that exist in the repo. Docs written with AI are fine; the code itself must be yours.
Reads your manifests, config, scripts and CI, then writes install, credential, build/run/test, quick start and troubleshooting sections with real versions and commands.
You are documenting this repository for a buyer who will take it over. Write a
file named run_instruction.md at the ROOT of the repository.
The reader is an experienced developer who has never seen this project and has
none of my accounts, API keys, cloud projects or machine setup. From this file
alone, they must be able to install, configure, build, run and test every part
of the project.
HOW TO WORK
1. Read the repository before writing anything. Inspect the manifests and
config files: package.json, pubspec.yaml, build.gradle, Podfile, Cargo.toml,
go.mod, requirements.txt, pyproject.toml, Dockerfile, docker-compose.yml,
Makefile, firebase.json, .github/workflows/*, .env.example files, and the
README. Work out which parts exist (mobile app, web, API, desktop, workers)
and which folder each lives in.
2. Take versions from the code: engines fields, SDK constraints, lockfiles,
.nvmrc, .tool-versions, CI workflow setup steps. Never guess a version. If a
version cannot be found, write "not pinned" and the version CI uses, if any.
3. Take commands from the code: package.json scripts, Makefile targets, CI
steps. Only write commands that exist. Do not invent scripts.
4. Find every value a new owner must supply: environment variables, API keys,
Firebase/Google/AWS project ids, OAuth client ids, signing keys, webhook
secrets. Search for process.env, dotenv, String.fromEnvironment,
os.environ, BuildConfig, Info.plist keys and config files. Name each one,
the file(s) it goes in, and where a new owner gets their own value.
5. Never copy a real secret, password, personal email or phone number into the
file. Use placeholders such as YOUR_STRIPE_SECRET_KEY.
THE FILE MUST HAVE THESE SECTIONS, IN THIS ORDER
1. What this is: one paragraph on what the product does, then a table of
parts: | Part | Folder | Stack |
2. Prerequisites: a table of | Tool | Version | Install | for every tool
needed, with exact versions.
3. Credentials and configuration: a table of | Placeholder | File(s) | What it
is | Where to get your own |, then numbered setup steps. Say which files a
CLI tool generates (and the command, e.g. flutterfire configure), which are
edited by hand, and how to confirm the setup worked.
4. Build, run and test: one subsection per part, with exact commands in code
blocks, run from the repo root (cd into the folder first), including the
local URL or port each part runs on.
5. Quick start: the shortest numbered path from a fresh clone to something
running.
6. Deployment: how it is deployed, based on the CI workflows and config files
that exist. Skip this section if nothing in the repo shows deployment.
7. Troubleshooting: a table of | Symptom | Cause | Fix | with at least five
real problems a new developer is likely to hit with this stack and this
setup, such as missing env vars, emulator ports, CocoaPods, code
generation, or Node or SDK version mismatches.
RULES
- Every claim must be true of this repository. If you are unsure about
something, check the file. If it cannot be determined, say so plainly
rather than guess.
- Plain Markdown. No emojis. No marketing language.
- Create or change ONLY run_instruction.md. Do not create any other file.
In particular, do not create CLAUDE.md, AGENTS.md, GEMINI.md,
.cursorrules, copilot-instructions.md, or any .claude/, .cursor/ or
similar folder, and do not edit code.
- Do not commit. I will review the file and commit it myself.
- Never run git commit, push, cherry-pick, merge, force-push or any history
rewrite on your own. If I ask for help with one, show me the exact command
and run it only after I say yes to that exact command.
AFTER YOU WRITE IT
The sale ships EVERY branch and tag, so run_instruction.md must be committed at the root
of every branch, before the history clean-up. Once I have reviewed it, give me
the commands (do not run them): commit it on my default branch and push, then,
for each other branch from `git branch -r`, one at a time:
git switch <branch> && git cherry-pick <default-branch> && git push origin <branch>
Tell me to do this before running clean-history.sh (guide:
https://xephas.me/code/prepare/#steps).
When you are done, list anything you could not determine, so I can fill it in.Goes through every module, route, endpoint and model, then lists every implemented feature, grouped by area, one concrete bullet each.
You are writing a complete feature inventory of this repository for a buyer
who is evaluating it. Write a file named FEATURES.md at the ROOT of the
repository.
HOW TO WORK
1. Read the code, not just the README. Go through every module, screen, route,
API endpoint, cloud function, database model, background job, integration
and test folder. Work out which parts exist (mobile app, web, API, desktop,
workers) and which folder each lives in.
2. List only features that are implemented in the code. A feature that is
planned, stubbed, behind a TODO, or only described in docs does not count.
If something is partly built, list it with "(partial)" at the end.
3. Look past the screens for engineering features too: authentication and
roles, multi-tenancy, offline support, payments and webhooks, caching,
validation, security rules, server-side checks, data migrations,
notifications, analytics, localisation, theming, CI/CD, test suites and
operational scripts.
FORMAT (follow it exactly)
- Start with "# <Product name>: Feature List".
- Then one short paragraph: what the product is, who it is for, and which
parts and stacks it is built from.
- Then one "## <Feature area>" heading per area, for example "## Job cards",
"## Payments", "## Authentication and access control", "## Offline and
connectivity", "## Testing". Order areas from the core product features
to the supporting engineering ones.
- Under each heading, bullets only. One feature per bullet, one line each,
specific and concrete. Write "Invoice create, edit, approve and delete" or
"Server-derived status computed from the checklist, never client-supplied",
not "Invoice management" or "Robust status handling".
- If the repository has several parts (e.g. app/, web/, api/), keep one
combined list, and put the part in brackets where it matters:
"- Stripe webhook signature verification [api]".
- End with a "## Codebase facts" section: parts and folders, main languages
and frameworks, the test frameworks and roughly how many test files, and
the CI workflows that exist.
RULES
- Every bullet must be true of this repository. If you are unsure, check the
code. Never invent features.
- No marketing language, no emojis, no prose paragraphs beyond the intro.
- Never include real secrets, customer names, emails or phone numbers.
- Create or change ONLY FEATURES.md. Do not create any other file. In
particular, do not create CLAUDE.md, AGENTS.md, GEMINI.md, .cursorrules,
copilot-instructions.md, or any .claude/, .cursor/ or similar folder, and
do not edit code.
- Do not commit. I will review the file and commit it myself.
- Never run git commit, push, cherry-pick, merge, force-push or any history
rewrite on your own. If I ask for help with one, show me the exact command
and run it only after I say yes to that exact command.
AFTER YOU WRITE IT
The sale ships EVERY branch and tag, so FEATURES.md must be committed at the root
of every branch, before the history clean-up. Once I have reviewed it, give me
the commands (do not run them): commit it on my default branch and push, then,
for each other branch from `git branch -r`, one at a time:
git switch <branch> && git cherry-pick <default-branch> && git push origin <branch>
Tell me to do this before running clean-history.sh (guide:
https://xephas.me/code/prepare/#steps).
When you are done, tell me how many feature areas and bullets you wrote, and
list anything you were unsure about.When every step and checklist item is done and you have exported the archive, submit the form. It opens in a new tab.
The export ships the whole repository: every branch, tag and pull request. That full record is what the sale pays for, so delivering a single branch earns less. Cleaning in place keeps every branch and keeps your pull requests attached to the repo. The backup from step 1 is your safety net.
No. clean-history.sh keeps every commit with its message, author and date; only the commit IDs change. A commit whose only change was a removed file stays, as an empty commit. To drop those instead, run it with PRUNE_EMPTY=1 and tell us the before and after numbers.
No. Pull requests live on GitHub, not in git, and stay attached to the repo because you push in place. Merge or close open ones first (step 3). The export includes them, with reviews and comments.
GitHub keeps a read-only ref for each pull request's head commit and never rewrites it, and the export includes them. So they still hold each pull request's files from before the clean-up, and only GitHub can delete them. Rotating every credential (step 6) makes any secret there useless. Personal data there isn't fixed by rotation: send us what check-repo.sh reports in section [10] (step 11), and we decide together on the handover call.
After the force-push, every existing clone is stale. Tell them to re-clone, and not to pull or push from an old clone: that would merge the old history back in.
Not on this repository between the force-push and the handover call: anything pushed after your check isn't checked. Afterwards, work from a fresh clone.
Your backup from step 1 holds the original history. Message us before you restore anything, so the right branches go back.
Any time after payment. Once the archive is verified on the call, we no longer need the repo.
Yes. Use the prompts on this page, then check every line against your code. AI-written docs are fine. What we can't accept is a codebase that was entirely AI-generated.
Warnings are for you to review, not automatic failures. Some are fine to leave, for example "0758... is our public support line". Message us if you are unsure about one.
Questions? WhatsApp Cephas Brian on 0758 294 212 or email xephas@aptahq.com or projects@aptahq.com