You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
stack: keep a project directory's stack across git branch changes, and add a prune command for stacks that no longer match a directory #7568
A managed stack is identified by the project root, the branch context and the stack name (packages/stack/src/identity/Identity.ts, deriveStackId). When the branch context changes, the directory stops selecting its stack, and the old stack stays where it is.
Observed on Supabase CLI 3.1.0: we created a stack in a project directory that was not a git repository (branch context ordinary-workspace). After git init on a main branch, supabase --experimental stack status reported "No managed stack exists for the selected project", while supabase --experimental stack list still listed the old stack under ordinary-workspace.
Nothing removes such stacks in bulk. The stack subcommands at 3.1.0 are destroy, install, list, logs, outdated, restart, start, status, stop and update. destroy takes a stack id and requires --yes; nothing finds the stacks whose directory no longer exists or no longer selects them.
Proposed solution
An option that takes the branch out of the stack identity, so a directory keeps its stack when it changes branch, for example supabase stack start --ignore-branch.
supabase stack prune, which lists the stacks whose project root no longer exists or no longer selects them, and removes them with --yes. Dry run by default.
Alternatives considered
Destroying each stack by id with supabase stack destroy --stack-id <stack id> --yes. This works, but the ids have to be found first, and nothing lists the orphans.
Activity
feat(cli): add `stack prune` for orphaned stacks (CLI-2548) (supabase…
fix(cli): point to stacks left on other branches (CLI-2980) (supabase…