Already Made a Mess of Your Notes? Here's the Fix

Already have split-brain repos, a secret in history, and pages moved on a whim? The recovery playbook: quarantine divergent copies, pick one authority, reconcile, and rebuild every projection clean.

On this page
  1. The four mistakes, and their fixes
  2. The reconciliation
  3. Right from day one beats recovery every time
  4. The swap-in box
  5. The series, end to end

Every rule in this series exists because it was learned the hard way. This capstone is for readers who are already living in the mess — divergent copies, a secret in history, folders reorganized on a whim — and need a way out. It’s the ⚠️ recovery chapter: how to reconcile a messy brain into a single clean authority.

The order of operations

Freeze → choose → reconcile → rebuild. Stop writing everywhere, quarantine every copy read-only, pick one authority, merge in the unique content from the others, then rebuild all projections from the clean source. Do not skip the freeze — reconciling a target that’s still being written to never converges.

First: make these values your own

The paths here are examples — use your own. /tmp/quarantine, the /path/to/… copies, and the-leaked-secret-value are placeholders; substitute your real copy locations and the actual string you’re purging before running anything.


The four mistakes, and their fixes

Everything below is recovery from one of these — each has a “right from day one” post earlier in the series:

The recurring four1. split-brain repostwo copies, no single authorityfix: one authority + read-only readers2. blanket auto-syncpushed bad state everywherefix: controlled-write lock3. secret in historycommitted, scrubbed too latefix: rotate + filter-repo purge4. status-based movesfolders churned, links rottedfix: identity over statusbuildahomelab.dev

The reconciliation

1Freeze: stop writing, quarantine every copy15 min

Make every existing copy read-only so nothing diverges further while you work. You’re taking a snapshot of the mess before untangling it.

Quarantine the copies

# Clone each copy into a read-only quarantine area (never edit these)
for c in laptop-copy cluster-copy old-backup; do
git clone --mirror /path/to/$c /tmp/quarantine/$c.git
done
chmod -R a-w /tmp/quarantine
2Choose the authority and diff the rest against it30 min

Pick the most complete copy as the starting authority, then find what exists only in the others so nothing unique is lost.

Find content unique to a loser copy

# Files present in a loser but not the chosen authority
git -C /tmp/quarantine/cluster-copy.git ls-files > /tmp/cluster-files.txt
git -C /tmp/quarantine/laptop-copy.git  ls-files > /tmp/laptop-files.txt
comm -23 <(sort /tmp/cluster-files.txt) <(sort /tmp/laptop-files.txt)

# For files in both, diff to see divergent content to merge by hand
git --git-dir=/tmp/quarantine/cluster-copy.git show HEAD:notes/x.md > /tmp/a
git --git-dir=/tmp/quarantine/laptop-copy.git  show HEAD:notes/x.md > /tmp/b
diff -u /tmp/a /tmp/b
3Purge any secret from the chosen history15 min

If a secret was ever committed to the copy you’re keeping, rotate it and purge history with git-filter-repo (the maintainers’ recommended history-rewriting tool) before it becomes your new authority — you don’t want to carry the leak forward.

Rotate first, then purge

# 1. Rotate the exposed credential at its source (do this first).
# 2. Purge it from the chosen copy's history:
git filter-repo --replace-text /tmp/replacements.txt
4Establish the single authority and rebuild projections20 min

Promote the reconciled copy to the canonical vault, put it behind the controlled-write lock, and rebuild every projection clean from it.

Rebuild everything from the clean source

# Rebuild each derived consumer from the new authority, then verify
node scripts/build-topic-map.mjs . --write --date 2026-07-15
verify-projection && verify-index
git -C /path/to/mirror reset --hard origin/master
Delete the quarantine only after verification

Keep the read-only quarantine copies until every projection verifies against the new authority and you’ve confirmed no unique content was lost. Then, and only then, delete them. They’re your undo button.


Right from day one beats recovery every time

Reconciliation works, but it’s a day of careful, nerve-wracking work you can skip entirely. Everything in this capstone is the expensive version of a cheap rule adopted early: one authority (post 2), no secrets (post 3), identity over status (post 5), a lock not a sync (post 7). If you’re reading this before the mess — go adopt those. If you’re reading it during the mess — you now have a way out.


The swap-in box

On other tools

Any Git-based notes: the freeze → choose → reconcile → rebuild order is tool-agnostic; only the commands change. Notion/Confluence tangles: export every space to Markdown first, then treat the exports as the quarantined copies and reconcile in Git where diffing is sane. The universal rule: never reconcile onto a moving target — freeze first, salvage unique content, and rebuild derived views only after a single authority exists.


The series, end to end

You now have the whole arc: why a second brain matters, the vault, secrets discipline, the graph, identity over status, projections, the write lock, AI cold-starts, multi-machine access, local RAG, health checks, and recovery. Build it right from day one and it compounds for years. Build it wrong and this last post gets you back to one clean brain.


Related posts:

Comments

Comments are powered by GitHub Discussions — sign in with a GitHub account to join the conversation.