dbt Cloud has always supported a custom branch name in development, but I was slow to make the change in our project because I thought it was going to be a big hassle. It was not a big hassle at all! This post is a PSA for anyone else who has been procrastinating the change.
Updating your branch only takes a couple of minutes, and consists of three (± one) simple steps:
- Rename your branch in GitHub (if necessary)
- Update the branch settings in your Environments
- Refresh your IDE
- Update your local git clone (if necessary)
If you’re setting up your dbt repo for the first time, this is probably redundant - your branch will likely already be called
The instructions on the GitHub help site are pretty comprehensive, but in short: go to the list of branches and click the icon.
Click the hamburger icon in the top left of the dbt Cloud interface, and go to Environments.
Click into your Development environment:
Tick the Custom Branch tickbox, type in the same name as your GitHub branch, then hit Save.
Repeat for the Production environment, as well as any other Environments you have.
The next time you or your colleagues open the IDE, you might see this warning message:
Make sure you have your work saved, then click Refresh IDE.
It should be OK to have code which is saved but not committed when you refresh the IDE. However, out of an abundance of paranoia I made sure no one was in the IDE and that everyone’s code was already committed when we made this change.
If you’ve cloned your repo to your computer, GitHub won’t automatically fix that for you. You’ll need to follow the directions on their help site to manually resolve the rename.
Pat yourself on the back - everything will keep working exactly as it did before. If I’ve missed anything, please share it below.