Create or Switch a Branch

When you create a visual application with a Git repository (instead of a scratch repo), VB Studio creates two branches in the repo: the default branch (usually, main) and a working branch.

The main branch contains the initial set of source files for the visual application. The working branch contains the same set of source files initially, but as you work on your visual application, this branch will contain the changes that you make. Using the Switch Branch option, you can commit your changes and then switch branches, or create a new branch from a parent branch that you select.

Note:

You don't have to switch to another workspace to configure another page in your application, as long as the target for your change is in your current Git repository. It's much faster to switch branches within a workspace than to switch workspaces. For example, suppose you're working in a Git repo for the Expenses application. While configuring the Create Expense Report page, you get an urgent request to fix something in Expense Details page and deploy it to your production instance. Rather than create a new workspace, you simply create a new branch, make the fix and publish it, then switch back to the Create Expense Report page code line and resume your work.

You use the Switch Branch dialog to switch branches or create a new branch from a parent branch that you select.

  1. Click the Git menu in the header or in the Git panel.
  2. Select Switch Branch.

    The Switch Branch dialog displays the current branch in the Branch drop-down list and the number of uncommitted files, if any.

  3. Choose the appropriate option:
    • To switch branches, select the branch that you want to switch to and click Commit and Switch or Switch. The button’s label depends on whether you selected the Commit changes before switching (recommended) checkbox.
    • To create a new branch, select the Create new branch based on parent branch checkbox, enter the name for the new branch, and click Commit and Switch (or just Switch).

      If the selected parent branch exists both locally as well as in the remote repository, select Use parent branch from remote repository to use the remote branch as your new branch's parent. You'd typically want to do this if the remote branch is more current than the local branch. Otherwise, the local branch will be used.