Learn how Neon compares to Aurora Serverless v2 - TL;DR: faster cold starts, responsive autoscaling, 80% lower costs

Reset from parent

Learn how to reset a branch from its parent

Neon's Reset from parent feature lets you instantly reset all databases on a branch to the latest schema and data from its parent branch, helping you recover from issues, start on new feature development, or keep the different branches in your environment in sync.

Example scenario

When working with database branches, you might find yourself in a situation where you need to update your working branch to the latest data from your main branch.

For example, let's say you have two child branches staging and development forked from your main branch. You have been working on the development branch and find it is now too far out of date with main.

You have no schema changes in development to consider or preserve; you just want a quick refresh of the data. With the Reset from parent feature, you can perform a clean, instant reset to the latest data from the parent in a single operation, saving you the complication of manually creating and restoring branches.

How Reset from parent works

When you reset a branch to its parent, the data and schema is completely replaced with the latest data and schema from its parent.

Key points

  • You can only reset a branch to the latest data from its parent. Point-in-time resets based on timestamp or LSN are possible using Branch Restore, a similar feature, with some differences: branch restore leaves a backup branch and is in general is intended more for data recovery than development workflow.
  • This reset is a complete overwrite, not a refresh or a merge. Any local changes made to the child branch are lost during this reset.
  • Existing connections will be temporarily interrupted during the reset. However, your connection details do not change. All connections are re-established as soon as the reset is done.

How to Reset from parent

You can reset any branch to its parent using any of our tools.

On the Branches page in the Neon Console, select the branch that you want to reset.

The console opens to the details page for your branch, giving you key information about the branch and its child status: its parent, the last time it was reset, and other relevent detail.

To reset the branch, select Reset from parent from the Actions menu or the Last data reset panel.

Reset from parent

note

If this branch has children of its own, resetting is blocked. The resulting error dialog lets you delete these child branches, after which you can continue with the reset.

Integrating branch resets in CI/CD workflows

You can include resetting database branches as part of your CI/CD workflow. For example, when starting a new feature or refreshing staging.

For new features

Initiate feature development by resetting your development branch to align with staging or production, ensuring a fresh starting point. Use the command:

neon branches reset --name dev-branch --parent staging

This strategy preserves a stable connection string for your development environment, while still giving your team a clean slate for each new feature.

Refresh staging

Keep staging in sync with production to minimize discrepancies. Automate staging updates with:

neon branches reset --name staging --parent main

This ensures staging accurately reflects the current production state for reliable testing.

Last updated on

Was this page helpful?