Use underscored branch names consistently

Branch names must use underscores, not hyphens. Restore the naming
convention note and fix all branch name examples across CI/CD and
branch development docs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Pablo Abella
2026-05-12 10:33:38 +02:00
parent d8e784968b
commit 7b71e5b40f
2 changed files with 18 additions and 16 deletions
@@ -30,15 +30,17 @@ Check out a git branch and run `tb dev` or `tb build`. Tinybird automatically cr
Manual:
```
tb branch create my-feature
tb branch create my_feature
```
Branch names must use underscores, not hyphens (e.g., `my_feature`, not `my-feature`).
### The `--last-partition` Flag
Use `--last-partition` to copy the latest partition of production data into the branch:
```
tb branch create my-feature --last-partition
tb branch create my_feature --last-partition
```
This is useful when you need real data to test queries, validate endpoint behavior, or debug issues that depend on production data shapes. Without it, the branch starts empty.
@@ -48,10 +50,10 @@ This is useful when you need real data to test queries, validate endpoint behavi
Use `--with-connections` to enable connectors (Kafka, S3, GCS) in the branch:
```
tb branch create my-feature --last-partition --with-connections
tb branch create my_feature --last-partition --with-connections
```
For S3/GCS, import sample data with `tb --branch=my-feature datasource sample <datasource> --wait`. Kafka connections are stopped by default and need to be started explicitly with `tb --branch=my-feature datasource start <datasource>`.
For S3/GCS, import sample data with `tb --branch=my_feature datasource sample <datasource> --wait`. Kafka connections are stopped by default and need to be started explicitly with `tb --branch=my_feature datasource start <datasource>`.
## Working with Branch Tokens
@@ -60,7 +62,7 @@ After creating a branch, you may need its token to connect client applications (
List tokens for a branch:
```
tb --branch my-feature token ls
tb --branch my_feature token ls
```
### Using Branch Tokens in Client Apps
@@ -98,9 +100,9 @@ This way, setting or unsetting the branch token switches between branch and prod
Most commands can target a specific branch with the `--branch` flag:
```
tb --branch my-feature endpoint data my_endpoint
tb --branch my-feature sql "SELECT count() FROM my_datasource"
tb --branch my-feature token ls
tb --branch my_feature endpoint data my_endpoint
tb --branch my_feature sql "SELECT count() FROM my_datasource"
tb --branch my_feature token ls
```
When `dev_mode=branch`, `tb build` targets the branch automatically without needing `--branch`.
@@ -138,7 +138,7 @@ Preview environments create an ephemeral Tinybird branch per pull request, so yo
### Using the TypeScript or Python SDK
The `tinybird preview` command (available in `@tinybirdco/sdk` and `tinybird-sdk`, not the `tb` CLI) creates a branch named `tmp-ci-<git-branch>`, builds resources, and deploys them:
The `tinybird preview` command (available in `@tinybirdco/sdk` and `tinybird-sdk`, not the `tb` CLI) creates a branch named `tmp_ci_<git-branch>`, builds resources, and deploys them:
```yaml
# GitHub Actions example
@@ -157,9 +157,9 @@ The `tb` CLI doesn't have a `preview` subcommand. Create preview branches manual
```yaml
- name: Create preview branch
run: tb --host ${{ env.TINYBIRD_HOST }} --token ${{ env.TINYBIRD_TOKEN }} branch create tmp-ci-${{ github.head_ref }} --last-partition
run: tb --host ${{ env.TINYBIRD_HOST }} --token ${{ env.TINYBIRD_TOKEN }} branch create tmp_ci_${{ github.head_ref }} --last-partition
- name: Build on branch
run: tb --host ${{ env.TINYBIRD_HOST }} --token ${{ env.TINYBIRD_TOKEN }} --branch=tmp-ci-${{ github.head_ref }} build
run: tb --host ${{ env.TINYBIRD_HOST }} --token ${{ env.TINYBIRD_TOKEN }} --branch=tmp_ci_${{ github.head_ref }} build
```
### Cleanup
@@ -168,10 +168,10 @@ Delete preview branches when the PR is closed:
```yaml
# SDK
- run: npx tinybird branch delete tmp-ci-${{ github.head_ref }}
- run: npx tinybird branch delete tmp_ci_${{ github.head_ref }}
# tb CLI
- run: tb --host ${{ env.TINYBIRD_HOST }} --token ${{ env.TINYBIRD_TOKEN }} branch rm tmp-ci-${{ github.head_ref }}
- run: tb --host ${{ env.TINYBIRD_HOST }} --token ${{ env.TINYBIRD_TOKEN }} branch rm tmp_ci_${{ github.head_ref }}
```
### Preview with connectors
@@ -179,19 +179,19 @@ Delete preview branches when the PR is closed:
When your project uses Kafka, S3, or GCS connectors, the `tinybird preview` command doesn't ingest data from connectors in preview branches. To test with connector data, create the branch manually with `--with-connections`:
```
tb branch create tmp-ci-my-feature --last-partition --with-connections
tb branch create tmp_ci_my_feature --last-partition --with-connections
```
For S3/GCS connectors, import sample data:
```
tb --branch=tmp-ci-my-feature datasource sample my_datasource --wait
tb --branch=tmp_ci_my_feature datasource sample my_datasource --wait
```
Kafka connections are stopped by default in preview branches. Start them explicitly:
```
tb --branch=tmp-ci-my-feature datasource start my_kafka_datasource
tb --branch=tmp_ci_my_feature datasource start my_kafka_datasource
```
## Key Principles