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.
Integrating branch resets in CI/CD workflos
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:
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:
This ensures staging accurately reflects the current production state for reliable testing.