Manage branches

Last Update: 1/23/2017
Team Services | TFS 2017

Manage the work in your team's Team Services Git repo from the Branches view on the web. Customize the view to track the branches you care most about so you can stay on top of changes made by your team.

Access the view by selecting Branches while viewing your repo on the web.

Access the branches view from your Git repo in Team Explorer

Organize your branches

The default Mine tab on the branches page shows branches you've created, pushed changes to, or set as a favorite. The default branch for the repo, such as master, is listed at the top. Select the All tab to view all branches in the repo. Filter the shown branches for a specific name or pattern in either view by entering text in the Search all branches box in the upper right.

Search and filter branches viewed using the search all branches field

Your repo's default branch (for example, master) will always sit at top of the list. If your team uses a forward slash separator in your branch names, you'll see a collapsible tree view for those branches.

TIP

Using a naming convention for your branches is highly recommended. See the branching guidance article for suggestions on how to name your branches.

Add favorite branches

Add branches from the All view to the Mine view by selecting the star icon to favorite the branch. Mark multiple branches as favorites by selecting the star icon on the tree view next to a folder on the tree. Remove favorites by toggling the star off or by selecting the ... to the right of the star to open the branch context menu, then selecting Remove from my favorites.

Set favorites in your branches to show them in the Mine view

Review updates to your branches

Each branch name has the name of the last contributor to the branch and a link to the latest commit on the branch. Select the date or time of the last commit to review the updates to the branch. The branch view also shows the number of commits the branch is ahead of and behind the branch labeled Compare. Use this information to quickly check how far a branch has diverged from another.

If the branch has a pull request open, you can see its current status based on the voting in the pull request. Select the pull request to open it up so you can review the details.

See how far a branch is ahead of and behind the compare branch

Change the compare branch

The ahead and behind numbers listed for each branch are in comparison with the branch currently labeled Compare on the Branches page. Update your compare branch to see how far ahead or behind your branches shown on the page are to another branch in your repo:

  1. Select the ... next to the branch you want to set as the baseline for comparison.
  2. Select Set as compare branch.

The Compare label will move to this branch and the branch will move to top of the list on the Branches page. The other branches on the page will have the number of commits ahead/behind updated to reflect the new comparison.

View branch history

Review the files in a branch or history by selecting the ... icon next to the branch name and choosing View files or View history. View files opens up the Files view on the web so you can browse the files based on the most recent commit on the branch. View history shows each commit in the branch history. Select a commit from this history to see the file changes made in that commit.

Access the view files and review history from the branches context menu

Change your default branch

Change the default branch used to merge code into when your team creates new pull requests. This is useful when you want to use a branch other than master for the main line of development in your repo.

  1. Select the settings icon while you have your team project open to bring up the project administration page.

    open up the administrative area of the team services web portal for your team project

  2. Select Version Control.

  3. Select your Git repository. Your branches are displayed under your repo.

  4. Select the ... next to the branch you want to set as default, then select Set as default branch.

    Set a default branch for a Git repo in Team Services or Team Foundation Server