Working With Branches

Applies to TestComplete 15.42, last modified on September 08, 2022

This topic describes how to work with Git branches from TestComplete.

Ways to work with branches vary depending on whether you use built-in TestComplete dialogs or use dialogs of the TortoiseGit client.

Working With Branches via TestComplete Dialogs

Creating New Branches

To create a new branch:

  1. Open the Branches dialog. You can do one of the following to display it:

    • Select File > Source Control > Branches from the TestComplete main menu.
    • Right-click within the Project Explorer and choose Source Control > Branches from the context menu.
    • Click Branches on the Source Control toolbar (if the toolbar is hidden, right-click the main menu and select Source Control in the ensuing context menu to show the toolbar).
  2. Right-click within the Local branches list and choose Create Branch from the context menu.
  3. In the ensuing New Branch dialog, specify a name for the branch.
    Creating branches via built-in Branches dialog
    Creating branches via built-in Branches dialog
  4. If you want to switch to the newly created branch, enable the Checkout New Branch option.
  5. Click OK to create a new branch.
  6. Click Close to close the Branches dialog.

This will create an empty named branch. Afterwards, you can submit changes to this branch.

Creating Branches When Committing

To create a new branch and submit changes to this branch:

  1. Open the Commit dialog. You can do one of the following to display it:

    • Select File > Source Control > Commit from the TestComplete main menu.
    • Right-click within the Project Explorer and choose Source Control > Commit from the context menu.
    • Click Commit on the Source Control toolbar.
  2. Click the ellipsis button next to the Branch field.
  3. In the ensuing Branch Operation dialog, select the Create a new named branch option.
    Creating branches via built-in Commit dialog
    Creating branches via built-in Commit dialog
  4. Enter the name of a new branch and click OK. This will close the Branch Operation dialog.
  5. Select the files you want to commit to the new branch.
  6. Specify a commit message.
  7. Click the Commit button to create a named branch and commit the changes to this new branch.

Switching Branches

To switch from one branch to another:

  1. Open the Branches dialog. You can do one of the following to display it:

    • Select File > Source Control > Branches from the TestComplete main menu.
    • Right-click within the Project Explorer and choose Source Control > Branches from the context menu.
    • Click Branches on the Source Control toolbar (if the toolbar is hidden, right-click the main menu and select Source Control in the ensuing context menu to show the toolbar).
  2. Right-click the desired branch and choose Checkout from the context menu.
    Switching branches via built-in Branches dialog
    Switching branches via built-in Branches dialog
  3. Confirm that you want to switch to the selected branch.
  4. TestComplete will notify you that project files were modified and suggest reloading them. Select Yes to All to reload all project files.

Merging Branches

To merge two separate branches into one branch:

  1. Open the Branches dialog. You can do one of the following to display it:

    • Select File > Source Control > Branches from the TestComplete main menu.
    • Right-click within the Project Explorer and choose Source Control > Branches from the context menu.
    • Click Branches on the Source Control toolbar (if the toolbar is hidden, right-click the main menu and select Source Control in the ensuing context menu to show the toolbar).
  2. Right-click the branch you want to merge with your current branch and choose Merge from the context menu.
    Merging branches via built-in Branches dialog
    Merging branches via built-in Branches dialog
  3. Confirm that you want to merge the selected branch and your current branch.
  4. TestComplete will notify you that project files were modified and suggest reloading them. Select Yes to All to reload all project files.

Deleting Branches

To delete an existing branch:

  1. Open the Branches dialog. You can do one of the following to display it:

    • Select File > Source Control > Branches from the TestComplete main menu.
    • Right-click within the Project Explorer and choose Source Control > Branches from the context menu.
    • Click Branches on the Source Control toolbar (if the toolbar is hidden, right-click the main menu and select Source Control in the ensuing context menu to show the toolbar).
  2. Right-click the desired branch and choose Delete Branch from the context menu.
    You cannot delete your current branch and unmerged branches.
    Deleting branch via built-in Branches dialog
    Deleting branch via built-in Branches dialog
  3. Confirm that you want to delete the selected branch.

Working With Branches via TortoiseGit Dialogs

Creating New Branches

To create a new branch:

  1. Open the Create Branch dialog. You can do one of the following to display it:

    • Select File > Source Control > Create Branch from the TestComplete main menu.
    • Right-click within the Project Explorer and choose Source Control > Create Branch from the context menu.
    • Click Create Branch on the Source Control toolbar.
  2. In the ensuing dialog, specify a name for the branch and other options (if needed).
    Creating branches via TortoiseGit Create Branch dialog
    Creating branches via TortoiseGit Create Branch dialog
  3. Click OK to create a new branch.

This will create an empty named branch. Afterwards, you can submit changes to this branch.

Creating Branches When Committing

To create a new branch and submit changes to this branch:

  1. Open the TortoiseGit Commit dialog. You can do one of the following to display it:

    • Select File > Source Control > Commit from the TestComplete main menu.
    • Right-click within the Project Explorer and choose Source Control > Commit from the context menu.
    • Click Commit on the Source Control toolbar.
  2. Enable the New branch option and enter the name of a new branch to the Commit to field.
    Creating branches via TortoiseGit Commit dialog
    Creating branches via TortoiseGit Commit dialog
  3. Select the files you want to commit to the new branch.
  4. Specify a commit message.
  5. Click the OK button to commit the changes to the new branch.

Switching Branches

To switch from one branch to another:

  1. Open the TortoiseGit Switch/Checkout dialog. You can do one of the following to display it:

    • Select File > Source Control > Switch/Checkout from the TestComplete main menu.
    • Right-click within the Project Explorer and choose Source Control > Switch/Checkout from the context menu.
    • Click Switch/Checkout on the Source Control toolbar.
  2. Ensure that the Branch option is chosen and select the desired branch in the drop-down list.
    Switching branches via TortoiseGit Switch dialog
    Switching branches via TortoiseGit Switch dialog
  3. Click OK to switch to the selected branch.
  4. TestComplete will notify you that project files were modified and suggest reloading them. Select Yes to All to reload all project files.

Merging Branches

To merge two separate branches into one branch:

  1. Open the TortoiseGit Merge dialog. You can do one of the following to display it:

    • Select File > Source Control > Merge from the TestComplete main menu.
    • Right-click within the Project Explorer and choose Source Control > Merge from the context menu.
    • Click Merge on the Source Control toolbar.
  2. Ensure that the Branch option is chosen and select the branch you want to merge with your current branch in the drop-down list.
    Merging branches via TortoiseGit Merge dialog
    Merging branches via TortoiseGit Merge dialog
  3. TestComplete will notify you that project files were modified and suggest reloading them. Select Yes to All to reload all project files.

Deleting Branches

To delete an existing branch:

  1. Open the TortoiseGit Switch/Checkout dialog. You can do one of the following to display it:

    • Select File > Source Control > Switch/Checkout from the TestComplete main menu.
    • Right-click within the Project Explorer and choose Source Control > Switch/Checkout from the context menu.
    • Click Switch/Checkout on the Source Control toolbar.
  2. Click the ellipses button next to the Branch option.

    This will open the TortoiseGit Browse Ref dialog.

  3. Right-click the desired branch and choose Delete Branch from the context menu.
    Deleting branch via TortoiseGit Browse Ref dialog
    Deleting branch via TortoiseGit Browse Ref dialog
  4. Confirm that you want to delete the selected branch.

Related Tasks

See Also

Integration With Git - Common Tasks
Integration With Git

Highlight search results