Creating Branches in TFS From Visual Studio

Branching: Branching is an important and powerful technique for creating a parallel set of versions of your files.

Figure 1 shows a branch structure in a hierarchical view.

Figure 1: Branch structure in hierarchical view

Use the following procedure to create branches in TFS from Visual Studio.

  • Connect to your Team Foundation Server (if you're not already) and open the team project you're working on.
  • Go to the Source Control Explorer. Once the Source Control Explorer is loaded you will see a list of all the team projects that hopefully includes yours. Expand the node for your team project and you should see the list of current branches as in the following.

Figure 2: Source Control Explorer

Now I want to create a branch for a FAST Search project. Right-click on the FAST Search folder and select Branching and Merging -> Branch from the context menu.

Figure 3: Context menu for Selecting Branch

Once you clicked on Branch it will open a prompt window and set the Target location and leave the defaults. I think we can uncheck the second check box, in other words Convert source and target folders to branches, then click on the OK button.

Figure 4: Prompt window for Branch

It may take some time to copy all files from the Source to the Target branch.

Once the Branch has been created you need to push these code changes to the server. The code changes you can determine in the Pending changes window. It may be difficult to select each and every file or folder from the pending changes window.

An easy way to select all the files at once is to go to the Source Control Explorer and right-click on your branch (that you created above) and select Check In Pending Changes, then it will open the Pending Changes window with Selected files then click on Check-In. Your changes (in other words branch) will move to the Server.

I hope this will be useful for you needs.

Similar Articles