Discover millions of ebooks, audiobooks, and so much more with a free trial

From $11.99/month after trial. Cancel anytime.

Hands-on Azure Repos: Understanding Centralized and Distributed Version Control in Azure DevOps Services
Hands-on Azure Repos: Understanding Centralized and Distributed Version Control in Azure DevOps Services
Hands-on Azure Repos: Understanding Centralized and Distributed Version Control in Azure DevOps Services
Ebook348 pages1 hour

Hands-on Azure Repos: Understanding Centralized and Distributed Version Control in Azure DevOps Services

Rating: 0 out of 5 stars

()

Read preview

About this ebook

Use Azure Repos to manage your code in both centralized and distributed version control systems. This book will show you how to work with Team Foundation Version Control (TFVC) and distributed version control (Git), while exploring their best practices. 
You'll start with an introduction to Azure Repos, focusing on TFVC and Git, and then gradually transition to hands on lessons of working with TVFC. Next, you'll see how to set up and work with TFVC branches and tracking systems followed by usage of command line and security in TFVC Repos. 
Create and work on Git Repos in Azure DevOps and use branching with Azure Git Repos and Git command line in Visual Studio and vscode. The book then explores security in Git Repos and advanced options you can use to import from external Repos. With Hands-on Azure Repos as your guide, you'll be able to work with these version control tools on any platform and with any language.
What You'll Learn
  • Integrate Azure Repos with Azure Boards to enable tracking work with code.
  • Create guidelines to tackle difficult situations in using Azure Repos
  • Clone Azure Repo to local using Visual Studio and vscode
  • Work with shelvesets, code reviews and lock types
  • Perform activities using REST API with Azure Repos
Who This Book Is For
Software developers, tech leads and architects.
LanguageEnglish
PublisherApress
Release dateDec 5, 2019
ISBN9781484254257
Hands-on Azure Repos: Understanding Centralized and Distributed Version Control in Azure DevOps Services

Read more from Chaminda Chandrasekara

Related authors

Related to Hands-on Azure Repos

Related ebooks

Programming For You

View More

Related articles

Reviews for Hands-on Azure Repos

Rating: 0 out of 5 stars
0 ratings

0 ratings0 reviews

What did you think?

Tap to rate

Review must be at least 10 words

    Book preview

    Hands-on Azure Repos - Chaminda Chandrasekara

    © Chaminda Chandrasekara and Pushpa Herath 2020

    C. Chandrasekara, P. HerathHands-on Azure Reposhttps://doi.org/10.1007/978-1-4842-5425-7_1

    1. Getting Started with Azure Team Foundation Version Control

    Chaminda Chandrasekara¹  and Pushpa Herath²

    (1)

    Colombo, Sri Lanka

    (2)

    Hanguranketha, Sri Lanka

    Team Foundation Version Control (TFVC) is a centralized version control system for your source code management. Generally, a team member will have one version of each source code file on their machine while using TFVC. Branches of source code are based on paths and get created on the server. A history of version control is maintained on the source control server, not on the local developer machine. In TFVC you can apply permissions at a granular level, and restrictions can be applied at the file level, which we will discuss in Chapter 6.

    In this chapter, we will explore the steps required to get started with TFVC in Azure DevOps using Visual Studio. You will be able to understand how to set up a team project to use TFVC or add a TFVC repo to an existing team project that is currently using Git repos. The steps required to set up your machine to develop with TFVC using Visual Studio will be described, and you will learn how to add new or existing solutions to TFVC in Visual Studio. Further, this chapter will discuss the different workspaces available in TFVC and the options to define and use code check-in (commit) policies. In addition, using TFVC with other developer tools such as VS Code and Eclipse will be described for you to get started even faster.

    Lesson 1-1: Creating a Team Project with TFVC and Adding a TFVC Repo to the Existing Team Project

    We discussed how to create a new team project in Chapter 1 of the first book, Hands-on Azure Boards, of this book series. However, let’s take a quick look at creating a team project with TFVC in this lesson to keep your experience seamless.

    Prerequisites: You have an Azure DevOps organization created, and you have some experience working with Azure DevOps to create team projects, or you have followed the lessons in Chapter 1 of the book Hands-on Azure Boards.

    Navigate to your Azure DevOps organization’s home page and click the Create project button in the top-right corner. See Figure 1-1.

    ../images/483399_1_En_1_Chapter/483399_1_En_1_Fig1_HTML.jpg

    Figure 1-1

    Creating project

    In the team project creation pane, provide a name and select TFVC as the version control system. You can set Work item process to whatever you’d like, as discussed in detail in the Hands-On Azure Boards book. See Figure 1-2.

    ../images/483399_1_En_1_Chapter/483399_1_En_1_Fig2_HTML.jpg

    Figure 1-2

    Creating a team project with TFVC

    The created team project has TFVC set as the repo by default, and you can view it by clicking the Repos menu option in the left menu. See Figure 1-3.

    ../images/483399_1_En_1_Chapter/483399_1_En_1_Fig3_HTML.jpg

    Figure 1-3

    TFVC repo

    Now, let’s look at how we can add a TFVC repo to an existing team project. Unlike Git where multiple Git repos can be added to a single team project, you can have only one TFVC repo per team project in Azure DevOps. Create a new team project with Git as the version control system. Then navigate to Repos in the left menu. On the Repos tab, click the drop-down next to the Git repo name and click New repository. See Figure 1-4.

    ../images/483399_1_En_1_Chapter/483399_1_En_1_Fig4_HTML.jpg

    Figure 1-4

    Creating a new repo in an existing project

    In the dialog that appears, select TFVC as the repo type and click Create to create a new TFVC repo in a team project that already has Git repos. See Figure 1-5.

    ../images/483399_1_En_1_Chapter/483399_1_En_1_Fig5_HTML.jpg

    Figure 1-5

    Creating a TFVC repo

    In this lesson, we explored how to create a TFVC repo in an existing team project or create a new team project with TFVC as the source control system.

    Lesson 1-2: Using Visual Studio Team Explorer

    We created a new team project in the previous lesson with TFVC as the source control system. As a next step, we need to connect it to Visual Studio to get started with the source code development. In this lesson, let’s discuss the steps required to get Visual Studio connected to your newly created team project in the TFVC repository, using the Team Explorer window in Visual Studio.

    Prerequisites: You have Visual Studio 2019 installed on your machine and are familiar with working with Visual Studio. You have followed the steps in Lesson 1-1 of this chapter and have a team project created with TFVC as the source control system.

    In Visual Studio, to open Team Explorer, you can click View ➤ Team Explorer in the menu or press Ctrl+\ and then Ctrl+M. The Team Explorer window lets you connect to Azure DevOps. You can click the Manage Connection toolbar icon to go to the Manage Connections page of the Team Explorer window. See Figure 1-6.

    ../images/483399_1_En_1_Chapter/483399_1_En_1_Fig6_HTML.jpg

    Figure 1-6

    Managing connections in Team Explorer

    Click the Connect link or click the drop-down next to the Manage Connections link (see Figure 1-6) and then click Connect to a project. In Team Explorer, the Manage Connection page will open as a pop-up window. In the Connect to a Project dialog, you can see the Azure DevOps organizations you have access to if you have already logged in to Visual Studio with a Microsoft account or your organization’s account. You can click Add an account or select a different account if you have connected more than one account. See Figure 1-7. If you click Add an account, you will be prompted for your credentials, and you can provide them to connect your Microsoft account or your organization’s account to Visual Studio.

    ../images/483399_1_En_1_Chapter/483399_1_En_1_Fig7_HTML.jpg

    Figure 1-7

    Adding or selecting an account

    Log on from the account you used to create a team project in the previous lesson and expand the Azure DevOps services organization to view your team projects and repositories. If you are using an on-premises Azure DevOps server, you have the option to provide an Azure DevOps server URL and connect it. In the expanded view, select the TFVC repo you want to connect and click the Connect button. See Figure 1-8.

    ../images/483399_1_En_1_Chapter/483399_1_En_1_Fig8_HTML.jpg

    Figure 1-8

    Connecting a TFVC repo

    Once the team project TFVC repo is connected, Team Explorer will allow you to map the TFVC path of the project to a local folder and create a workspace. There are two types of workspaces, and we will discuss them in Lesson 1-4. Provide a desired local path and click the Map & Get button. See Figure 1-9.

    ../images/483399_1_En_1_Chapter/483399_1_En_1_Fig9_HTML.jpg

    Figure 1-9

    Map & Get button

    In this lesson, we discussed the steps required to connect and map a local path for a TFVC repository using Visual Studio.

    Lesson 1-3: Adding New/Existing Solutions to TFVC

    Once we map the TFVC repository in Visual Studio, we are allowed to add new solutions to version control using the Solution Explorer window of Visual Studio. Let’s look at the steps to add a new solution to TFVC and how you can add an existing solution to TFVC using the Solution Explorer window of Visual Studio.

    Prerequisites: You performed the steps described in the first two lessons in this chapter.

    In Team Explorer, you will see the New link, which allows you to create a new solution. Click it. See Figure 1-10.

    ../images/483399_1_En_1_Chapter/483399_1_En_1_Fig10_HTML.jpg

    Figure 1-10

    Creating a new solution

    Then in the Create a new project dialog, search for console application, select the .NET Framework console application, and click Next. See Figure 1-11.

    ../images/483399_1_En_1_Chapter/483399_1_En_1_Fig11_HTML.jpg

    Figure 1-11

    Creating a console application

    In the next step, provide a name for the project. Do not change the Location path as the new solution is already being created in the mapped path of TFVC. Click Create to create the new application. See Figure 1-12.

    ../images/483399_1_En_1_Chapter/483399_1_En_1_Fig12_HTML.jpg

    Figure 1-12

    Creating the console application in the mapped source path

    Once the new solution is created, view it in the Solution Explorer window of Visual Studio. You can open Solution Explorer by pressing Ctrl+Alt+L or by clicking View ➤ Solution Explorer in the Visual Studio menu. If you have an existing solution that you need to add to TFVC, copy all the content of the solution to the mapped local drive path of TFVC and then open that solution in Visual Studio. Once you create/open a solution in Visual Studio, go to the Solution Explorer window and right-click the solution you want to add to TFVC. Then click Add Solution to Source Control in the context menu. See Figure 1-13.

    ../images/483399_1_En_1_Chapter/483399_1_En_1_Fig13_HTML.jpg

    Figure 1-13

    Adding the solution to source control

    You will notice that all the files in the solution are marked with a +, indicating that they are ready to be checked in (committed) to TFVC. See Figure 1-14.

    ../images/483399_1_En_1_Chapter/483399_1_En_1_Fig14_HTML.jpg

    Figure 1-14

    Solution ready to be checked in

    Next open the Team Explorer window and click Pending Changes. In the Pending Changes window of Team Explorer, you will be able to see the new solution files are ready to be checked in. You can provide a comment and check in your code to TFVC. Further, you can see the Related Work Items options allowing you to add a work item, which we will discuss in Chapter 2. Note that there are some local file changes detected (this is because of the default local workspace; we will discuss the difference between the server and local workspaces that are available for TFVC in Lesson 1-4). See Figure 1-15.

    ../images/483399_1_En_1_Chapter/483399_1_En_1_Fig15_HTML.jpg

    Figure 1-15

    Pending changes

    Click the detected changes in the Excluded Changes section. A dialog will appear, and you will be able to see the local files that should be ignored by source control. Select all the files and right-click to open a context menu. In this window, you are allowed to promote files, which will be included as changes. Or you can ignore local-only files. Since

    Enjoying the preview?
    Page 1 of 1