Preview branches now archive themselves

Set a policy to archive preview branches once they go quiet. Choose how many days without a deployment, keep the branches you never want touched, and preview exactly what the next cleanup will retire.

Daniel Sutton

Daniel Sutton

Senior Backend Engineer, Trigger.dev

Set the policy once

Flip on Auto-archive in the toolbar and pick a window: archive any preview branch that hasn't had a deployment in that many days, counting from its creation if it never deployed. The default is 14 days. From then on the cleanup runs on its own, retiring branches as they fall idle. An archived branch turns read-only and stops counting against your active-branch limit, and you can recreate a branch with the same name whenever you need it back.

Keep the branches that should stick around

Long-lived branches like main or staging shouldn't be on a timer. Add them to the keep list and they're never auto-archived, however long they sit idle. The list takes exact branch names, no wildcards, so nothing gets swept up by a loose pattern.

See a cleanup before it runs

Before you save, the Preview section spells out what the policy would do right now: how many branches are eligible to archive immediately, how many will archive later if nothing new deploys, and which kept branches it will skip. You set the rule with the outcome in front of you.

Try it

Open Preview branches, flip on Auto-archive, and set your window. It's live in your dashboard now.

Ready to start building?

Build and deploy your first task in 3 minutes.

Get started now