Azure DevOps, Git and VS Code

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video we set up vs code to work with git repos in azure devops [Music] hello everyone i'm travis and this is raltos azure devops has a built-in web-based ide or integrated development environment but i've gotten comfortable with many of the features of vs code and want to use vs code to create and modify template files powershell and other source code files in this video we're going to walk through setting up git on a local computer to work with vs code then clone a repo and push changes back to azure devops before that please take a second to like subscribe and click the bell icon for notifications of new content if you'd like to learn more about windows virtual desktop check out my course zero2hero with windows virtual desktop on udemy.com when you create a repo in azure devops there are two options for version control get and teams foundation version control we're going to work with git for this example git works by cloning a copy of the files to your local machine you work on them locally and then push the changes back git is an advanced version control system and that description only scratches the surface of what it can do i have a blog post that's intended to get loan scripters and teams of one up and running with get and github a lot of the information in that blog post will cover in this video i'll include links to that below if you're interested in learning more in order to use git repositories we have to install get and configure a couple settings we'll walk through setting that up next okay more demo less talking you'll need an account with azure devops and vs code installed on the local computer to follow along links to all of these sites will be below let's get started by downloading get here we are on the workstation this demo assumes you have vs code installed if not download and install it quick once ready we're going to download and install git let's search for git download here's the get download link we'll select the client for windows or whatever platform you use i don't have a mac os i assume it will be the same process though if you are using a mac or linux there's also a gui client that's not the version we want well maybe you do but i don't all we need is the command line part the rest is done by vs code download and run the setup for your os 64-bit for this example and we'll run the installer we're going to select the default for everything there's one thing i will point out the default editor is vim you won't encounter vim while using vs code but if you do more with git you may end up in a vim editor at some point i point this out because it can be a bit tricky to exit vim if you're not familiar with it you can change this to another text editor if you'd like notepad plus plus or vs code are both good options i'll leave it as default and go to next and we'll next our way through the rest of the installer there we go and we'll wait until it's finished click finished when done you can read the release notes if you'd like to i don't need to we'll go to finish we only need to configure two items and get to get started let's bash that out go to git bash here we are in bash next we have to let git know who we are this information is used to track who's making changes to code very useful for a version control system we're going to enter two configuration commands one of them sets the username and one of them sets the email address be sure to enter two dashes in front of global and we'll enter in our username next is the email address again two dashes in front of global and that's it and again make sure to enter that double dash in front of global that is the tough part you can close bash now now we can go to devops you can use an existing repo for this next step as long as it's set as a get repo let's go to the one i did on a video last week about setting up a simple server if we go to repose you can tell it's using a git repo because of the commits pushes and branches options under repo the team's foundation version control repo would not have these options let's clone this repo to our local workstation go to clone you have two options to clone a repository one you could copy this link and use that in vs code to clone the repository the other option is click the clone to vs code button and notice there are other options here if you have another ide you want to use let's click clone to vs code and we'll click yes to switch the apps and again we'll click open it will ask for a location for the repository i like to create a folder under my documents for git repos you can store them anyplace local except for locations that are replicated like a onedrive folder we use git to keep files in a central location we don't need file synchronization on top of that so we'll select this location and git will create a subfolder for the repo when prompted sign in with the same account you use to sign into azure devops and then next we'll click open to open the repository that worked now we have the same files that are in devops copied to the local computer git doesn't sync files we clone a repo locally make changes and then push the changes to the remote repository we can also pull changes from the remote repo to refresh the local copy let's go to the readme file we're going to add a new line and now save the file notice the version control symbol shows that there's been a change let's go back to devops we'll close that and if we open the readme file the change has not been pushed to the repo yet so we don't see the update let's go back to vs code from here we'll go into version control the first thing we're going to do is click the plus sign next to the readme file this stages the changes if there were multiple files changed we could stage some or all of the files next we're going to commit enter a message for the commit you need to add a message and it should be something descriptive so others reviewing changes know what was done commit next by clicking the check mark that commits the change to the local repository on your hard drive we still need to push those changes to the repo we do that by going to the three dots and push now let's go back to devops if we refresh we should see a new line there's the new line let's go to history here it shows the commit we have the message and also who did it and the time it was done next let's remove the new line in the readme file we go to edit and then delete that line once it's been deleted click commit this is a commit just like what we did in vs code only we're doing it on the remote repository instead of our local copy click commit the change has been made and the new line is gone next let's go back to vs code back at the readme file it still shows our change because it was updated remotely but we haven't pulled down the change yet so let's go back to version control and this time we're going to run a get poll and that updates our local copy this is great for one person but if you had a team of people working on the same source code you'd need to be more cautious about commits pushes and polls that's why git has the option to create branches that can be modified separate from the master branch and then merge back in but that's a topic for a different day for this video that's how we use get with vs code and azure devops i hope this helps you get started with git repositories and vs code please don't forget to like and subscribe and thanks for watching
Info
Channel: Travis Roberts
Views: 10,573
Rating: 4.9649124 out of 5
Keywords: Azure DevOps, DevOps, Git, Azure Pipelines, Pipeline, automation, infrastructure as code, Azure, subscription, repo, git push, git pull, VS Code, deployment, CI/CD, cloud computing, Microsoft azure, YAML, azure devops tutorial, azure devops for beginners
Id: 8ER87ePdoCU
Channel Id: undefined
Length: 11min 30sec (690 seconds)
Published: Fri Mar 19 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.