By branch I mean the git branch. We use Source Control and have a separate branch for staging.
The user event triggering this is a button click in most cases, but we also have use case where it's used inside a script run on page load that redirects the user to the correct application
I did try out the approach you outlined in our application, but it seems like the application doesn't redirect to the branch name specified but rather the default branch main
Maybe it's because we're embedding the retool app inside an external application ?
If you're using the Retool Embed product, you can include the branch name as a param when creating an embed url.
It doesn't look like there is a URL param available for branches, but if you know the name you can input it into the URL (in a go to URL event):
For example: https://my_instance.retool.com/tree/<my_branch_name>/editor/<my_app_name> or https://my_instance.retool.com/tree/<my_branch_name>/apps/<my_app_name>