git-backup
Skill0 starsChanged 4 months agoMITView on GitHub
Full disaster-recovery backup of ~/.claude to a PRIVATE git repo, and non-destructive restore from it. Save triggers on "back up", "git backup", "snapshot my claude config", "DR backup". Restore triggers on "restore from git backup", "recover my claude config".
2 other projects use a version of this.
Adopted by
Most recently taken up by
- lemonorangeapple/JuneAgenttheir own version, first seen Aug 15, 2026
- THEROCKSSS/hermes-skills-portfoliotheir own version, first seen Aug 3, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- lemonorangeapple/JuneAgent★ 1same name
- THEROCKSSS/hermes-skills-portfolio★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 38
if you have your own work staged, it skips the snapshot rather than absorb it (SKIP snapshot: user has staged work — pending commits still …
- Very specific: line 59
No destructive git: never reset --hard / push --force / clean -f.
- Distinctive: line 61
If push is rejected as non-fast-forward, do NOT force.
- Distinctive: line 74
Use the non-destructive steps below.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Extra message: $ARGUMENTS
Requires the kit's scripts installed at
~/.claude/scripts/(see SETUP.md). The repo URL lives in~/.claude's git remote (origin), not in this file — keep it private; even with the whitelist, your config/memory is yours.
Pick a mode first
- "back up / snapshot / DR backup" -> the Save steps below.
- "restore / recover" -> jump to the Restore section at the bottom.
Goal
Snapshot the whole ~/.claude (a git work tree whose origin is your PRIVATE config
repo) for full recovery after a machine failure. Take everything at once — do not
cherry-pick; the whitelist .gitignore already keeps secrets out.
Save (one entry point — don't hand-compose add/commit/push)
Why one script: the manual add -> commit -> push -> verify chain kept turning into hand-composed compound commands, which is exactly where mistakes (and, in Claude Code, permission-prompt noise) creep in. The unattended SessionEnd hook already runs a deterministic script — manual saves go through the same single entry.
- Run (pass
$ARGUMENTSas-Noteif present; otherwise omit-Noteentirely):
The script does, in order (do not re-implement these steps by hand — one entry point, one implementation):pwsh -NoProfile -File ~/.claude/scripts/auto-backup.ps1 -Note "<$ARGUMENTS>"- snapshots machine config living outside
~/.claudeintoprofile/(your PowerShell profile etc. — extend$Sourcesinsnapshot-machine-config.ps1) - if you have your own work staged, it skips the snapshot rather than absorb it
(
SKIP snapshot: user has staged work— pending commits still push) git add -A(safe: the whitelist.gitignoreexcludes credentials/history/ sessions/caches/plugins by construction)- fail-CLOSED secret scan covering everything a push would publish: the staged
snapshot before commit AND every not-yet-pushed commit before push (so a secret
committed by hand still cannot leave). On a hit it does NOT push and returns an
ABORT:line naming rule@file (never the secret itself); relay that line to the user verbatim and stop. Audited false positives go in.lifeboat-allowlist.txt(one regex per line, matched against<ruleId> <path>). - skips the commit when the tree is clean, but still pushes pending commits
left by an earlier failed push (
OK: pushed N pending commit(s)) - concurrent sessions are serialized by a mutex (
SKIP: lock busymeans another session is mid-git — not an error, the next trigger retries)
- snapshots machine config living outside
- Verify (report evidence, not vibes): the commit hash, and
## main...origin/mainwith no ahead/behind:cd ~/.claude && git status -sb && git log -1 --oneline
Rules
- No destructive git: never
reset --hard/push --force/clean -f. This backup is append-only (add -> commit -> push). - If push is rejected as non-fast-forward, do NOT force. Stop and report; reconcile manually.
Restore — get your structure back on a dead / new machine
Preconditions:
- The repo is PRIVATE -> you must be authenticated to clone. Check
gh auth status(logged in, token scope includesrepo). If not, ask the USER to rungh auth loginin a browser and stop. Never handle tokens for them; auth is per-machine and is intentionally NOT in the backup. - Viewing the repo web page is not enough — restore is only via an authenticated
git clone. ~/.claudeusually already has content -> you cannot clone directly into a non-empty dir. Use the non-destructive steps below.
Steps (non-destructive, no destructive git):
- Auth check:
gh auth status(if not logged in, ask the user togh auth loginand stop). - Clone somewhere else (do NOT touch
~/.claude):git clone <PRIVATE_BACKUP_REPO_URL> ~/_claude-restore - Decide how to reconcile with any existing
~/.claude(irreversible -> confirm with the user):- New / near-empty machine -> rename existing aside (
~/.claude->~/.claude.bak-YYYYMMDD), then move the clone into place. Most faithful (an exact copy of the repo). - Keep existing, overlay -> copy the clone's contents excluding
.git(rsync -a --exclude='.git' ~/_claude-restore/ ~/.claude/on macOS/Linux;robocopy "$HOME\_claude-restore" "$HOME\.claude" /E /XD .giton Windows). Copying.gitinto a directory that already has one corrupts the repo. Then reconnect git as its own step: if~/.claudehas no repo, move~/_claude-restore/.gitin; if it already is one,git fetchand reconcile instead (no resets).
- New / near-empty machine -> rename existing aside (
- Re-resolve machine-specific values. Old absolute paths (drive letters, usernames,
install locations) are invalid on the new machine. Fix
settings.jsonand anything under**/memory/that references old paths. - Put the outside-the-repo files back.
profile/manifest.json({schemaVersion, entries:[{file, source}]}) records, for every snapshot inprofile/, the absolute path it came from (source). Copy each file back — but inspect any existing file at the destination first (a fresh machine may already have its own profile; merge by hand, don't blind-overwrite). Paths inside these files need the same re-resolution as step 4. - Restart Claude Code (settings / skills / hooks load at startup).
- Cleanup: remove
~/_claude-restoreonce verified (keep the.bakuntil the user confirms).
Also needed after restore (excluded from backup by design): gh auth login; your git
identity (~/.gitconfig lives outside ~/.claude, so git config --global user.name /
user.email are gone — the very first backup commit on the new machine fails with
"Author identity unknown" until you set them); plus any local API keys / external tool
setup. These are intentionally not tracked.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

