Branches (Beta)¶
Tinybird branches allow you to develop and test your project in ephemeral environments using production data.
Branches are currently in beta. Some features might not be available yet or might change in the future.
Create a branch¶
tb branch create preview_1
If you want to use production data, you can use the --last-partition flag yo bring the last partition of the production data into the branch.
tb branch create preview_1 --last-partition
Start branch¶
tb --branch=preview_1 dev
Keep this terminal running while you are working in the branch.
tb dev will watch for changes in your project and rebuild it automatically.
» Building project... ✓ datasources/user_actions.datasource created ✓ endpoints/user_actions_line_chart.pipe created ✓ Rebuild completed in 0.2s
If you stop the process with Ctrl+C, you will stop the branch.
» Received shutdown signal, stopping... ✓ Branch 'preview_1' session stopped
Make changes to your project¶
While tb --branch=preview_1 dev is running, you can edit files in your project and see the changes automatically applied in your branch.
Using your editor¶
Open your editor of choice and start editing your project. The branch will automatically detect the change and rebuild your project:
» Building project... ✓ datasources/user_actions.datasource updated ✓ Rebuild completed in 0.3s
Using Tinybird UI¶
You can also use Tinybird UI to edit your project. Run the following command to open the Tinybird UI pointing to your branch.
tb --branch=preview_1 open
tb dev exposes your project as API, so you can edit it directly in the browser and see changes applied automatically.
When to use branches¶
Branches are a great way to test your project with real production data. You should use them in the following scenarios:
- You want to test your changes with real production data.
- You work with preview environments in your CI/CD pipeline before deploying to production.
- You don't use Docker and you want to test your changes without affecting production.