Saturday, May 28, 2022

Azure DevOps - Azure Repos

 Azure Repository is a set of version control tools that we can use to manage our code. In case we are entirely new to version control, then version control enables us to track changes we make in our code over time. There is so much software that is available in the market to enable version control on our code. We can use the version control system to keep track of each change done by each developer, safely merge them, test the changes, and publish the change into production.

There are two types of version control in Azure Repos.

  • Git: It is a distributed version control.
  • Team Foundation Version Control: It is centralized version control.

Azure Repos Concepts

  1. Repository: A repository is a location for our code, which is managed by version control. It supports Git and TFVC so we can create multiple repositories in a single project and various branches for each repository.
  2. Branch: A branch is a lightweight reference that keeps a history of commits and provides a way to isolate changes for a feature or a bug fix from our master branch and other work.
  3. Branch policies: It is an essential part of the Git workflow. We use them to help protect the critical branches is our development, as the master.
  4. Pull and Clone: Create a complete local copy of an existing Git repo by cloning it. A pull command updates the code in our local repository with the code that is in the remote repository.
  5. Push and Commit: A commit is a group of change saved to our local repository. We can share these changes to the remote repository by pushing.
  6. Fork: A fork is a complete copy of a repository, including all file commits, and (optionally) branches.
  7. Git: Git is a distributed version control system. Our local copy of code is a complete version control repository that makes it easy to work offline or remotely.
  8. Notification: Using notification, we will receive an email whenever any changes occur to work items, code reviews, pull requests, source control files and builds.
  9. Projects: A project provides a place where a group of people can plan, track progress, and collaborate on building software solutions.
  10. Teams: A team corresponds to a selected set of project members. With teams, organizations can subcategorize work to better focus on all of the work they track within a project.

Import Repository From Github.

You follow the below steps to import a repository that is created on Github.

1. Select Azure Repos from Azure Project and Click on Repos drop down and Click on Import repository.

2. Provide the URL for the GitHub repository
(If it is a private repository then provide the credentials) and the Name for your azure repo.

3. Once you click on the Import button, the repository will be created and you can see it in the azure repo list.

Create an empty Azure Repo.

1. Select Azure Repos and select New Repository from the drop-down.
2. Provide the name of the repository ( Let's say MyAppRepo) and click on Create button

3. Once the repository is created then it will provide the clone URL of the repository and steps to push the existing repository.

Create a project in Visual Studio and connect to Azure Repository.

1. Create a new project in Visual studio with the core application with some sample code.
2.  Click on Git--->Manage Remotes
3.  Click on Add button to add the Azure Repo URL and provide the name of the repository and in the fetch textbox enter the URL of Azure Repo.
4.  Once the repo is added then you can use Git Menu to handle the git related operations like pull, push, commit, etc
5.  Once Repo is created you can see the project files in the azure repos.


Post a Comment