← Back to Articles         
Azure Repos – Git-Based Source Control

Azure Repos – Git-Based Source Control

Published on 08 Oct 2026     11 min read Azure DevOps
Azure Repos

Azure Repos – Git-Based Source Control in Azure DevOps

1. What is Azure Repos?

Azure Repos is a source control service provided by Microsoft Azure DevOps. It allows developers to store, manage, track, and collaborate on source code using version control systems.

Azure Repos supports two types of version control:

  1. Git – Distributed Version Control System (DVCS).

  2. TFVC (Team Foundation Version Control) – Centralized Version Control System.

Git is the most commonly used option for modern software development.

Simple example

Suppose five developers are working on an ASP.NET Core Web API application.

Without source control:

  • Developers may overwrite each other's code.

  • Tracking who changed the code becomes difficult.

  • Recovering previous versions is challenging.

  • Managing development and production releases becomes difficult.

With Azure Repos:

  • All developers work with a shared remote repository.

  • Each developer can create a separate branch.

  • Code changes are tracked through Git commits.

  • Developers can submit Pull Requests for code review.

  • Approved changes can be merged into the main branch.

  • Azure Pipelines can automatically build and deploy the application.

Important: Azure Repos stores and manages source code, while Git performs the underlying version control operations.

 

2. Why do we need Azure Repos?

Purpose

Explanation

Source code management

Store application source code in a centralized remote location

Version control

Maintain the complete history of code changes

Team collaboration

Multiple developers can work on the same project

Branch management

Separate development, testing, and production code

Code review

Review changes using Pull Requests

Security

Control repository access using permissions

CI/CD integration

Integrate repositories with Azure Pipelines

Code recovery

Restore previous versions when required

Real-time scenario

Consider a banking application with three developers.

  • Developer A develops the Customer API.

  • Developer B develops the Account API.

  • Developer C fixes a production defect.

All three developers work on separate Git branches without directly modifying the production branch.

After development and review, their changes are merged into the appropriate shared branch.

This reduces the risk of introducing unreviewed changes into production.

 

3. How does Azure Repos use Git?

Azure Repos acts as a remote Git repository hosting service.

Git manages commits, branches, merging, and version history. Azure Repos provides remote hosting, collaboration, permissions, Pull Requests, and integration with other Azure DevOps services.

Simplified Git collaboration and CI/CD workflow

Git workflow

Developer writes code
        ↓
git add
        ↓
git commit
        ↓
Local Git Repository
        ↓
git push
        ↓
Azure Repos (Remote)
        ↓
Pull Request
        ↓
Code Review / Approval
        ↓
Merge into main
        ↓
Azure Pipelines
        ↓
Build → Test → Deploy

Key point: Git commands work the same way whether the remote repository is hosted in Azure Repos, GitHub, or another Git hosting service.

 

4. How to create a Git repository in Azure Repos

Step 1: Open Azure DevOps

Visit https://dev.azure.com.

Sign in and select your organization and project.

Step 2: Create or open a repository

Navigate to:

Azure DevOps → Project → Repos → Files

From the repository selector, create a new Git repository if required.

Example repository name:

BankingWebAPI

Step 3: Clone the repository

Copy the HTTPS clone URL from Azure Repos.

Example:

git clone https://dev.azure.com/MyOrg/BankingProject/_git/BankingWebAPI

This downloads the repository to your local machine.

The command creates a local Git repository containing the available Git history and configures a remote named origin.

For a private repository, Git requires authentication using a supported method, such as Git Credential Manager or SSH.

 

5. Important Git commands used with Azure Repos

These commands are executed on your local machine, using Git or a Git-enabled IDE such as Visual Studio 2026.

Command

Purpose

git clone <url>

Download the remote repository

git status

Check modified and staged files

git add .

Stage changes

git commit -m "message"

Save changes in local Git history

git push

Upload commits to Azure Repos

git pull

Fetch and integrate remote changes

git fetch

Download remote updates without merging

git branch

List local branches

git switch -c feature/login

Create and switch to a branch

git merge

Merge changes from another branch

git log

View commit history

Practical example: Push code to Azure Repos

Assume you have cloned the repository and modified CustomerController.cs.

1. Check modified files

git status

2. Stage changes

git add .

3. Commit changes

git commit -m "Added Customer API"

4. Push to Azure Repos

git push origin main

Now the committed changes are available in the remote main branch, assuming you have permission to push directly.

In team projects, developers generally push to feature branches and use Pull Requests to merge into protected branches.

 

6. Branching in Azure Repos

Branching allows developers to develop features and fix defects independently without directly affecting the production code.

Example branch structure

main
 ├── develop
 │    ├── feature/customer-api
 │    ├── feature/account-api
 │    └── feature/login
 │
 └── hotfix/payment-error

Branch

Purpose

main

Production-ready code

develop

Integration branch for ongoing development

feature/*

Individual feature development

hotfix/*

Urgent production defect fixes

release/*

Optional branch for release preparation

This is one possible branching strategy, similar to GitFlow. Azure Repos does not require a particular branch structure.

Create a feature branch

git switch develop

git pull origin develop

git switch -c feature/customer-api

After development:

git add .

git commit -m "Implemented Customer API"

git push -u origin feature/customer-api

The new feature branch is now available in Azure Repos.

 

7. What is a Pull Request in Azure Repos?

A Pull Request (PR) is a request to review and merge code changes from one branch into another.

For example:

Source Branch:
feature/customer-api
        ↓
    Pull Request
        ↓
    Code Review
        ↓
    Approval
        ↓
Target Branch:
develop

How does it work?

  1. A developer completes the Customer API.

  2. The developer pushes the feature branch to Azure Repos.

  3. The developer creates a Pull Request targeting develop.

  4. Reviewers inspect the code changes.

  5. Automated build validation may run.

  6. Reviewers approve the Pull Request.

  7. The Pull Request is completed and changes are merged.

Important PR features

  • Code review and comments

  • Reviewer assignment

  • Branch policy enforcement

  • Build validation

  • Work item linking

  • Merge conflict detection

  • Merge strategies such as squash, rebase, and merge commit

Interview point: A Pull Request is a collaboration and code-quality mechanism provided by Azure Repos. Git itself provides merging, but Pull Requests are a hosting-platform feature.

 

8. Security and Branch Policies

Azure Repos provides repository permissions and branch policies to help protect important branches.

Repository permissions

Administrators can control who is allowed to:

  • Read and clone repositories.

  • Contribute and push changes.

  • Create branches.

  • Manage Pull Requests.

  • Manage repository permissions.

Branch policies

For important branches such as main, administrators can configure policies such as:

Policy

Purpose

Minimum reviewers

Require approval before merging

Build validation

Require a successful build

Linked work items

Require associated Azure Boards work items

Comment resolution

Require PR comments to be resolved

Required reviewers

Require specific reviewers for selected code changes

Merge strategy restrictions

Limit permitted merge methods

Example:

Developer pushes feature branch
             ↓
Creates Pull Request to main
             ↓
Minimum 2 reviewers required
             ↓
Build validation must pass
             ↓
PR policies satisfied
             ↓
Merge allowed

Policies protect the PR completion process; administrators should also configure permissions to prevent unauthorized direct pushes or policy bypasses.

 

9. Azure Repos and Azure Pipelines Integration

Azure Repos stores the application source code.

Azure Pipelines uses that source code to perform automated builds, tests, and deployments.

Example: ASP.NET Core Web API

Azure Repos
    ↓
Developer merges code into main
    ↓
Azure Pipeline Triggered
    ↓
Restore NuGet Packages
    ↓
Build .NET Application
    ↓
Run Unit Tests
    ↓
Publish Application
    ↓
Deploy to Azure App Service

Sample YAML pipeline

File: azure-pipelines.yml

trigger:
  - main

pool:
  vmImage: 'ubuntu-latest'

steps:
  - task: UseDotNet@2
    inputs:
      packageType: 'sdk'
      version: '8.0.x'

  - script: dotnet restore
    displayName: 'Restore Packages'

  - script: dotnet build --no-restore
    displayName: 'Build Application'

  - script: dotnet test --no-restore
    displayName: 'Run Unit Tests'

  - script: dotnet publish -c Release -o $(Build.ArtifactStagingDirectory)
    displayName: 'Publish Application'

This pipeline runs when changes are pushed or merged into main, assuming the YAML pipeline has been created and enabled.

It restores dependencies, builds the application, runs tests, and publishes build output to the staging directory. Actual deployment requires additional deployment tasks or stages.

 

10. Azure Repos vs Git vs GitHub

This is an important interview comparison.

Feature

Git

Azure Repos

GitHub

Type

Version control system

Repository hosting service

Repository hosting platform

Local commits

Yes

Uses Git

Uses Git

Remote repository hosting

No

Yes

Yes

Branching and merging

Yes

Yes

Yes

Pull Requests

Not built in

Yes

Yes

Code review UI

Not built in

Yes

Yes

CI/CD

External integration

Azure Pipelines

GitHub Actions

Azure DevOps integration

Via tools

Native

Supported

Repository permissions

Local/file-level mechanisms

Yes

Yes

Important differences

Git: The version control engine installed on your computer.

Azure Repos: Microsoft's service for hosting and managing Git repositories within Azure DevOps.

GitHub: Another Git hosting platform, with its own collaboration and automation features.

You can use Azure Pipelines with either Azure Repos or GitHub. Using Azure Repos is not mandatory for Azure Pipelines.

 

11. Advantages and Disadvantages

Advantages

  • Native integration with Azure Boards and Azure Pipelines.

  • Supports Git-based distributed development.

  • Provides branch policies, permissions, and Pull Requests.

  • Maintains code history and supports collaboration.

  • Works with Visual Studio, VS Code, and Git CLI.

  • Supports multiple repositories within an Azure DevOps project.

 

Disadvantages

  • Developers must understand Git concepts.

  • Merge conflicts require manual resolution when automatic merging is not possible.

  • Permissions and branch policies require proper configuration.

  • Advanced CI/CD workflows require additional pipeline configuration.

  • Azure DevOps administration can introduce complexity for small teams.

 

12. Important Interview Questions and Answers

Q1. Is Git mandatory for Azure Repos?

No. Azure Repos supports both Git and TFVC. However, Git is the preferred choice for most modern development projects.

Q2. Is Azure Repos the same as Git?

No. Git is a distributed version control system. Azure Repos is a Microsoft-hosted source control service that supports Git repositories.

Q3. Can we use Azure Repos without installing Git?

You can browse and edit files through the Azure DevOps web interface. However, normal local Git operations require a Git client, either standalone or integrated into an IDE.

Q4. Can multiple developers work on the same repository?

Yes. Developers clone the repository, work on separate branches, and push their changes. Pull Requests are used to review and integrate the changes.

Q5. What is the difference between a local repository and Azure Repos?

A local repository exists on the developer's machine. Azure Repos hosts the remote repository that team members can access.

Q6. Can Azure Repos trigger CI/CD pipelines?

Yes. Azure Repos can trigger Azure Pipelines when configured events occur, such as pushes to specified branches. Pull Request validation can also be configured.

Q7. Can we connect Azure Repos to Visual Studio 2026?

Yes. Visual Studio supports Git operations with Azure Repos, including cloning, committing, pushing, pulling, branch management, and Pull Requests.

Q8. What happens if two developers modify the same line?

Git may detect a merge conflict when integrating their changes. The conflict must be resolved before the merge can be completed.

Q9. What is the difference between Azure Repos and Azure Pipelines?

Azure Repos manages source code, while Azure Pipelines automates building, testing, and deploying applications.

Q10. Can a single Azure DevOps project contain multiple Git repositories?

Yes. For example, one Azure DevOps project can contain separate repositories for Web API, Angular frontend, and shared libraries.

 

13. Real-Time Interview Scenario

Question: Your team has five developers working on an ASP.NET Core Web API project. How would you manage source code using Azure Repos?

Answer:

We use Azure Repos with Git for source control. Our production-ready code is maintained in the main branch, and ongoing development is integrated into the develop branch.

Each developer creates a separate feature branch from develop. After completing development, they commit changes locally and push their branch to Azure Repos.

Developers create Pull Requests to merge their changes into develop. We enforce branch policies such as mandatory code reviews and build validation.

Once the changes are approved, they are merged into the target branch. Azure Pipelines performs automated builds and tests, followed by deployment through our configured release process.

This approach helps us maintain code quality, track changes, collaborate effectively, and protect production code.

Key points to remember

  • Git = Version control engine.

  • Azure Repos = Remote source code hosting and collaboration.

  • Branch = Independent line of development.

  • Commit = Saved version of code.

  • Push = Upload local commits to remote repository.

  • Pull = Fetch and integrate remote changes.

  • Pull Request = Review and merge code changes.

  • Branch Policy = Rules protecting important branches.

  • Azure Pipelines = Automated build, test, and deployment.

One-line interview answer: Azure Repos is a source control service in Azure DevOps that uses Git to manage code versions, branches, commits, and team collaboration, with features such as Pull Requests, branch policies, and CI/CD integration.

← Back to Articles