Working with Azure Repos
In today’s blog post, we will learn how to create a new branch, then merge branches with pull request and create a new tag in Azure repos.
Create a new Azure DevOps project
Step 1: Login to your Azure DevOps portal using below link.
Step 2: Click “New Project” and provide a name, description and visibility level for your Azure DevOps project and click ‘Create’.
Click on the Repos
Click on the “initialize” to initialize your Azure Repo with a README.md file. You can also import an external git-based repository by clicking on the “Import”.
Our Azure Repo has been initialized with a first commit.
How to create a new branch in Azure Repo?
Step 1: Click on “Branches” and then “New branch” to create a new branch.
Note: Currently you have a branch named “main” which is the default branch for your Azure repo. You can change the default branch name for a new repository using project setting page.
Step 2: Provide a name to your branch and a branch that the new branch is based on. Since we have only one branch “main”, our new branch will be created form this branch. Click “Create” to create the new branch.
A new branch named “feature” is created in your Azure repo.
Next, we will add some files and directory to our Azure repository, click on the branch name to get inside your branch.
How to create files and directory in Azure repo?
Step 1: Click on the options => New => Folder.
Note: You can also upload files from your local system to Azure repo by clicking on the “Upload file(s)”.
Note: You can download the content of Azure Repo by clicking on the “Download as Zip”
Note: You can also fork (create a new repo using content of existing repo) by clicking on “Fork”.
Step 2: Provide a folder name and file name and click “Create”.
Step 3: Add the content for the new file and click “Commit”.
Step 4: Provide a commit message and click “Commit”.
How to view commit messages in Azure repo?
You can view all the commit messages in your Azure Repo under commits section.
Next, we are going to raise a pull request to merge our feature branch with main branch.
How to raise a pull request in Azure Repo?
Step 1: Navigate to “Pull requests” section and click “New pull request”.
Step 2: Provide the required details like “Title”, “Description” and optionally add “Reviewer” to review and approve the changes and click “Create”.
If you have added approver, the approver needs to approve the changes before you can merge your branch with the main branch. Finally click “Complete” to merge the feature branch with main branch.
Click on “Complete merge” to merge your feature branch with the main branch.
Now if you look into your main branch, you will be able to see the changes that you have added in the feature branch in your main branch.
Next, we will create a new tag out of our merge commit.
How to create a tag in Azure repo?
Step 1: Navigate to the “Commits” section, select the commit option and click “Create tag”.
Step 2: Provide a tag name and description and click “Create”.
A new tag has been added to your Azure Repo.
You can also view the tags under “Tags” section.
Hope you have enjoyed this article. To know more about Azure DevOps, please refer below official documentation