Skip to content
GhostbranchdocsGitHub

Removing a repo

Stop using Ghostbranch on a repo, and know what stays behind for you to delete.

ghostbranch remove takes a repo pair off your machine. It never touches GitHub, so what it leaves behind there is yours to keep or delete.

Your private work lives in the shadow repo. Removing the pair from your machine doesn’t touch it, but deleting the shadow repo afterwards would lose every feature that was never published. So first:

  • publish or merge what you want to keep, or copy those branches somewhere else;
  • run ghostbranch status to see what’s still open.

--plan (or --dry-run) shows what it would take off this machine:

Terminal
ghostbranch remove --dry-run
Dry run; nothing was changed. This would:
- revoke the agent grant for you/project
- remove /home/you/.local/state/ghostbranch/workspaces/default/plans/20261010T151924Z-2e1bbe.json
12 more plan files
- remove /home/you/.local/state/ghostbranch/workspaces/default/plans/20261012T172824Z-af556e.json
- remove /home/you/.local/state/ghostbranch/workspaces/default/pairs/you__project
- write /home/you/.local/state/ghostbranch/workspaces/default/workspace.json

That is:

  • Agent grants for the pair are revoked, and so are its waivers. This pair had a grant and no waivers.
  • Plan files for the pair are deleted. Any plan you hadn’t applied can’t be applied afterwards.
  • Ghostbranch’s copy of the shadow repo on your machine (the pairs/ folder) is deleted.
  • The pair is dropped from the workspace, the list of pairs this machine knows.

The ledger keeps the pair’s history, so ghostbranch log still shows it.

Terminal window
ghostbranch remove

Because it revokes grants and waivers, it asks for a one-time code at your terminal, like a publish. An agent grant doesn’t cover it, so an agent can’t remove a pair. It needs no GitHub token.

It works on one machine only. On your other machine, run it there too.

Nothing changes on GitHub:

  • The public repo is as it was, with every pull request Ghostbranch opened.

  • The shadow repo keeps its branches, features, gate branches and draft pull requests. To get rid of it, delete it on GitHub yourself, in its settings, under Danger Zone. Ghostbranch never deletes a repo.

  • The push guard stays in each checkout where you installed it. It can no longer tell which repo it guards, so it refuses every push to the public repo from that checkout, and says to uninstall it. Pushes to other remotes aren’t affected. Run this in each checkout:

    Terminal window
    ghostbranch guard uninstall

    An older pre-push hook that the guard was chaining is put back.

  • Your login stays, since other repos may use it. ghostbranch logout removes it.

APPROVAL_REQUIREDexit 5This needs a person: a code typed at a console. For promote and apply, an agent grant also works.
Causes
  • no_console: no terminal a person can type into
  • not_confirmed, timeout, too_many_attempts: the person did not confirm
  • grant_needs_yes: a grant exists, but --yes was not passed
What to do

Stop and give the human the command in next. It needs a person at a console; for promote and apply, an agent grant made with ghostbranch agents allow also works (feature close and remove ignore grants). Never fake a terminal, answer the code, edit grants.json or run ghostbranch agents allow yourself.

This needs a person.

PUSH_BLOCKEDexit 1The pre-push guard refused to push feature work to the public repo.
Causes
  • pushing a feature branch, the overlay branch or a gate branch to the public remote
  • pushing commits that contain a shadow feature
What to do

Publish features only with ghostbranch promote. Never bypass the hook with --no-verify.

NOT_A_PAIR_CHECKOUTexit 2This directory is not a checkout of a registered public repo.
What to do

Run the command inside a clone of the public repo, after ghostbranch init.

LEDGER_NOT_WRITTENwarningThe command did what its result says, but its entry in the ledger (ghostbranch log) couldn't be written.
What to do

Nothing is undone and nothing needs running again. Keep details.refs when it is there: after a close it lists every deleted ref with its SHA, which the ledger would have kept for recovering a branch. If it repeats, check that the workspace's ledger file is writable and the disk has room.