N
Neon2mo ago
deep-jade

New parent branch

Hi! Does setting a new branch as default mean all new branches created will use that as the new parent? I want to designate a new protected branch as my new parent moving forward.
9 Replies
wise-white
wise-white2mo ago
Hey! When you a set a branch as default, new branches will be children of that branch unless specified otherwise.
deep-jade
deep-jadeOP2mo ago
awesome! In that case, i just want to run by what im doing right now. Currently i have a production branch thats default. I also have a separate staging branch was previously branched off of production but is now protected and maintained separately as a fork. What i want to do is maintain production as a separate fork, but have staging as the parent so that all my review apps by default are branched from staging. If thats the case, do i simply just set staging as the default branch to achieve the above?
wise-white
wise-white2mo ago
If I understand correctly you want production to still be the root branch, have staging be a child of prod, but the parent of all future branches? If so, then yes, setting staging as default will be accomplish that. If you want prod and staging to both be root branches, then you'll want to create a new staging branch with the schema-only option (which will create a second root branch), then set it as default, and all future branches will be children of it.
deep-jade
deep-jadeOP2mo ago
whats the benefit of having two root branches in the above scenario?
wise-white
wise-white2mo ago
None really, I just wasn't sure I was understanding correctly, and I got the impression that that might have been what you meant. Sorry for any confusion!
xenial-black
xenial-black3w ago
I have a question here Sam, i tried the same thing having a develop branch that was a child of the main branch and then switched develop to be the default branch but this changes my integration with vercel and modified the env variables to point the production deployoment to the dev branch. Then how i can acomplish this
wise-white
wise-white3w ago
Hey @Osmar, do I understand correctly you created a dev branch which was a child of the root prod branch, made that dev branch the default branch, and now Vercel is pulling the env variables from your dev branch (that is now default), not from your root prod branch?
xenial-black
xenial-black3w ago
Yeah exactly that @Sam The risk with that is that we got an outage as result since on the next deployment after the modification of the default branch, it changed the url poiting to the dev one not the production one Cuz we didnt know about this, the fix was to make main branch default again and i confirmed that when you switch the default branh neon updated the database url on vercel
wise-white
wise-white3w ago
That's the intended behaviour. If you don't want to be branching off prod, then pin the prod vercel env to your master git branch and prod neon branch, then create a staging neon branch and make it default so that all future branching is done off of staging. Is that what you're after?

Did you find this page helpful?