Publishing Branches

If you want to push to, pull from, or synchronize using a branch you have created, you must publish the branch. You can still commit to an unpublished branch, but until you publish, you will not be able to send your commits to the remote repository. It is a good idea to publish branches unless you are only using a branch locally for a short period of time.

You can publish branches in the following ways:

How to Manually Publish Branches

  1. Select View > Source Control Explorer. The Source Control Explorer opens.

  2. From the drop-down or the Home pane, select Branches.

    The Branches pane opens. In the pane, you can see your current branch, as well as lists of your published and unpublished branches.

  3. Select the unpublished branch you want to publish.

  4. Click Publish Branch.

  5. (Optional) If you did not commit your files before publishing the branch, a dialog asks if you want to commit your files. Click Yes to continue. See Committing Source Control Files—Git.

    Note You must commit all modified files before you can publish the branch.

  6. The Select Remote for Publish dialog opens. From the Remote drop-down, select the repository you want to push to.

    Note If you have pending changes that you are committing while publishing your branch, you will see the Select Remote for Push dialog. However, the steps for pushing while publishing a branch are the same. See Pushing Files to a Remote Repository—Git for additional information.

  7. (Optional) To add or remove a remote repository, click The browse ellipsis button opens to more options.. The Remote Repositories dialog opens.

    To Add a Remote Repository

    1. In the Remote Repository field, enter the address of the new repository.

      Note You may need to obtain this information from your system administrator.

    2. In the Alias field, enter a name for the new repository. This is the name that will appear in the Remote drop-down when you need to select a remote repository.

      Note Repository names cannot include spaces.

    3. Click Add to add the new repository to the list of available repositories.

    4. Click OK.

    To Remove a Remote Repository

    1. From the Remote Repository list, select the repository you want to delete.

    2. Click Remove. The repository is removed from the list of available repositories.

    3. Click OK.

  8. In the Select Remote for Publish dialog, click OK. If the Log In dialog opens, complete the User name and Password fields and click OK. Your branch is published and added to the Published Branches list.