Azure DevOps provides developer services to support teams to plan work, collaborate on code development, and build and deploy applications
Azure Devops is a popular Source Control Management/Build system that is SAAS based inside of Azure, this article will show you how to use and understand Azure DevOps/Git/VSCode from a sysadmin point of view.
To start with you will need to create an Azure account and head over to the Azure Devops portal and create an organization by following the prompts. Once your organisation is created you will need to create a project and choose whether you want it to be public or private (If under 5 people are going to be using Azure Devops then you can have unlimited Public/Private repos). I personally prefer to Initialize a repo from the GUI you are already in the portal anyway.
To Initialize a repo from the GUI, select Repos from the left-hand side and select Initialize from the bottom of the page. This will automatically generate a basic README.md and then drop you into the repo. From there you will need to install VSCode and Git and install a couple of basic extensions in VSCode. To get to the extensions menu use the shortcut Ctrl + Shift + X and add these extensions; Azure Account, Azure Repos and probably Powershell and Bracket Pair Colorizer 2. To start using Git you have to do some very basic config in command prompt/Powershell which is basically just 2 lines
git config --global user.name "Your Name"
git config --global user.email firstname.lastname@example.org
Now if we switch back to the Azure Devops window and click the Clone -> Clone in VSCode -> Sign into Azure and then chose where you want to save the repo. Congratz! You have now completed the “hardest part” of getting started. From here we will start getting into Git terminology and some example workflows.
You should never be working on the “master” branch as this is a sure-fire way to make your repository an absolute mess (I unfortunately know from experience), what you want to do is make a new branch for each “feature” you wish to make. In my current repository, all I have is the default README.md
Now if I wanted to make some major changes to this repository, I’d create a new branch from the master by going to the Command Palette (Ctrl + Shift + P) and searching for “Branch” and choosing “Create Branch From..”, Create a name for your branch and then chose the master branch. From there you will be on your new branch which wont affect the master one in anyway so you can modify files to your hearts content. Make some changes to your file and save it, Then change to the Source Control tab (Ctrl + Shift + G) and you will be able to see there are changes. You can click on your files and see what data has been added/deleted/changed. From there we will want to stage & commit these changes. Go to the Command Pallete (Ctrl + Shift + P) and search for Commit and press enter. You will then get a prompt saying there are no staged changes and asks you if you would like to automatically stage and commit your changes, I personally always want this to happen but it is personal preference. Enter a commit message and press enter. This will then commit your new branch to Azure Devops which you can check in the portal and you can compare between the master branch and your branch to see that while they are different. The master branch has remained the same. To push your changes to the master branch you will need to create a pull request, once again I like to use the GUI for this for simplicity. In the Repos section go to “Pull Requests” and select Create a pull request and you will see a screen such as the one below.
Note underneath the “New Pull Request” you will see your branch name into master which shows the way that the request is going. You will also get a chance to provide a lot of information on the change as well as add reviewers so your code can get peer reviewed by a colleague before you push it out
Once you have created the pull request you can then complete the pull request and the changes will then get pushed into the master branch where everyone can see it.
Congratz! You have now got a very basic understanding of Azure Devops & VSCode which will allow you to actively use VSCode.