Learn collaboration with the new Visual Studio 2019 GitHub experience

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
this is the third in a three-part video series about working with visual studio 2019 and the new get experience i'm going to assume you already installed and configured git on your local computer i'm also going to assume you installed visual studio 2019 on your computer i'll assume that you're at least using the free community edition and that you have upgraded to at least 16.10.3 this training video is all about collaborating on github so you do at least need to set up one free account on github but here's a tip if you get a second account you can actually create a fake one that represents the other person you're collaborating with so it could be fun to watch this video with another friend and kind of play with this together or you could have two github accounts and switch between the two of them whether you created one or multiple accounts on github sign in to each one of them you're probably going to have to go through a two-step verification process and all that good stuff and then finally you can go to a profile and it might look something like this please note when i'm working with github i use dark mode so my user interface might look slightly different than yours we need to connect visual studio and github so go into visual studio without running any code without loading any projects and head over here to your avatar which you can see at the top right hand corner then go ahead and choose account settings in the all accounts section if you do not see a github account then you need to add it so we'll click the add item here and choose github you'll either be prompted with a login to type in your username and password or you'll get this success item now what you want to see right now is your primary github account if you created a fake github account to be a collaborator you don't want this one what you'll need to do is remove this clear your cookies and your history on your browser or if you're really good at it and you know what to do just remove the github cookie come back and add it and it will ask you to enter your username and password instead okay so that's what you want is your primary personal github account right now we're good to go we'll go ahead and close now we're going to create a project so go to the file menu choose new and choose project you can feel free to enter any kind of project you want we are doing not a whole lot more than what you'd expect to know like a whole hello world kind of scenario but for me i'm going to choose asp.net core web app and then i'm going to choose asp.net core empty and then i'll click next i'll give the project a name and i'm going to call it vs 2019 github collaboration click the next button and then click create cool now we have the project let's just make sure that it runs so i'll just go ahead and run the application and for me a browser window opens up and it says hello world even though it's an empty application there's a little bit of text in there just make sure that it's working back in visual studio we need to add our code to source control and that will be git and then we're going to push that up to github so we'll come over here to the bottom right corner of visual studio and choose add to source control and choose get once we're in the dialog you could you should see github listed right here if you don't see github then i suggest you go back to my other videos that show you how to set this up okay so now we just need to verify that our account is the right account it just says bill raymond it's not my fake collaboration account and i'm going to deselect make it private if i make it private then only i can access it or people that i share this with right now for this video we're going to focus on collaborating within the github community so we'll probably treat it like it's more like an open source project okay so let's go ahead and create and push this up to github once complete we'll see that the little github icon is here and it's showing me the name of my repo up on github now i'm just going into github to verify that the repo actually exists so here i am in github.com and i'm signed in i'm just going to go ahead to my avatar and choose your repositories and then i should see the new repo called vs 2019 github collaboration i'll click that link and just sort of make sure that the code exists and it looks like i have successfully pushed my code up to github okay i've got this github collaboration site it's my first open source project i'm really excited i want someone to come in and start working with me so i blog about it and i talk about it and someone sure enough does as a matter of fact i have a guest here right now hey you want to join me yeah yep sure thing i'll take the seat and now we're going to collaborate on this github project now here i am logged into my github account and you can see i only have one repo now there are two ways that i can get access to bill's code one is he could add me as a user and i can start making code changes or two i can make code changes without bill even asking and then suggest them to him and he has full control over everything that happens in his repo so let's go ahead and do that let's go to the search bar in github and type in vs 2019 github collaboration and then i'll just come over here to all github in the search bar and there i can see that's bill's code repo right there that's the one he's asking for contributors so i'll go ahead and select that and you'd think i'd just come over here to the code menu and clone it or download it to visual studio but if i try to make changes i'm going to be trying to making changes directly to this repo and i don't have access to that so here's what i'm going to do i'm going to make a forked copy you can see that fork icon up here on the top right when i click it you'll see that github will create a new copy of the code under my account okay so let's go back to my list of repos i'll click on my avatar and go to my repositories and there you can see there's the code now what i've done is i've created a copy and github is fully aware that this is actually linked to bill raymond's code but any changes i make here will not go back to bill unless i ask him to accept the changes so really this is kind of my copy because we want to do all of this using visual studio i'm going to go back in here to visual studio and click on the icon from my account and choose account settings and you can see i'm logged into my github account here if you forgot how to remove and add an account then just go back to the beginning of this video where bill clearly explains it just to recap i created a forked copy of bill's code on github that does not automatically come down to my computer i have to do that manually so what i'm going to do is go to the get menu and choose clone repository then i'll come down here to github and it will show all of the repositories that i can bring down one of them is that vs 2019 github collaboration and you can see it even has a little fork icon next to it okay i'm going to go ahead and clone that and now i have a local copy on my computer there are two things you need to be aware of when you bring something down from github first of all and i think microsoft's going to fix this but for now anytime you bring something down from github you're going to get the team explorer window window open and oddly enough that this feature is being deprecated so what you want to do is close that so locate the team explorer and click the little x icon to close that now the other thing that you need to be aware of is while you did just bring down the repo it's actually not in the solution view so you should see something that looks like this with the folder structure but it's not your typical c sharp projects folder structure that you'd be used to in visual studio now if you don't see this where you can just click on the solution file you don't see the git attributes in git ignore or the vs 2019 github collaboration folder just click up here where it says switch between solutions and available views just keep clicking that until you see something that looks like this one here then double click on the solution and now you can see we have a much better view this is what i'd expect to see from visual studio a nice folder-based layout along with dependencies and things like that that i can control using visual studio with the c-sharp project just because this code should be the same doesn't mean that it is i just want to make sure that there's no dependencies or other things that are required so i'm just going to run the project and make sure it works cool it ran and there's that hello world text that i want to modify so let's get down to that now now here's my plan i want to go ahead and make changes to the startup.cs file that's where that hello world text is so what i'm going to do first is create a new branch and i'm going to do this whether i create a whole bunch of files or just modify a file it's the same process so i'll come down here to where it says main and select that there's a new branch button which i'll select and then i'll create a new branch and i'm going to call this adjust title in startup and then i'll say base it on main and check it out and click create notice i had to type in dashes you can't just put a space in the name of a branch okay so here we go i want to open up the startup.cs file so i'll double click on that and i'll scroll down to find that hello world text there it is okay so i'm going to select this line and copy it into my clipboard create another line and paste it in now the first thing i want to do is make that hello world a lot more prominent so i'm going to put that in an h1 tag and then i'm going to end the line with a slash h1 tag the second hello world i'm going to change that completely and i'm going to type welcome to my site if i can type okay cool so i'll go ahead and save that now before i go and commit the change what i want to do is make sure that it works so i'm going to come up here and run the code oh yeah bill is going to love this look at that large hello world text and the welcome to my site text i definitely want to share this with him at this point i made this really cool change and i want to share it with bill but it's still just on my local computer and i haven't even committed the code yet so the first thing i'm going to do is commit it what i'm going to do is come down here to the bottom of visual studio and i'll see this little pencil with the one next to it you might see two because visual studio might have updated the solution file but you should only have one in typical scenarios i'll click on that and you can see here is our option to commit our changes so here's what i want to do is make a message that is clear what i'm doing so i'm just going to say add h1 tag to hello world and add a sub title with welcome to my site on startup dot cs okay so you really don't want to go too much further than that with most of your commits i'll just go ahead and click commit all there i have now committed the change on the adjust title and startup branch but i have yet to send this to bill now what you'll notice in this user interface is it will say one outgoing zero incoming so if i click on this you'll see this whole user interface over here that allows you to look and see kind of what changes have been made on your computer versus what changes have yet to go up to github i'm going to close this what i want to point out is down here at the bottom of visual studio you always get these really nice notifications as to what's going on with git and this right here has a one with an up arrow next to it and when i click on this it says push so i can just go ahead and push that up to github and in the background visual studio will do that and then once complete you'll notice up here in the get changes tab we'll say do you want to create a poll request well you know what i could do this and this is where i now have github send bill my code changes to take a look at but what if this doesn't exist i'm actually just going to show you how to do this without having this dialog here it's the same exact thing so if you want to use this create pull request go ahead but i'm going to show you another way so i'm going to go ahead and close these two yellow notification boxes okay it's all coming down to this i made my changes locally and i sync them up to github now i want to ask bill if he's interested in receiving them so this is how i can create a new pull request and the pull request sounds weird right like why am i pulling it i'm actually pushing it to bill no but what's happening here is i'm going to ask bill to pull down the code and review it so that's what a pull request is we also call them prs you'll hear me refer to them that way later okay so there's two ways you can do this one is to go to the get menu and go to github and choose new pull request now watch what happens here it opens up github and starts to create it here that's all fine and good it'll all still be synchronized with with visual studio anyway but why not just do this inside of visual studio so i'm going to go ahead and close the browser and show you another way first you should have the github tab somewhere on visual studio if you didn't if you don't have it rather go to the view menu and find github in my case it's all the way over here down under other windows and when i go to other windows there's github right there so it's actually quite deep in there but once you select that the tab should open somewhere in visual studio just like i have right here if you don't have that view menu option then you're gonna have to go to bill's other videos and check those out okay now i can see right here there's a create new option so let's go ahead and do that so you can see it says there's that last commit that i made to the branch to add h1 tag to hello world looks like i made a little mistake i put w there at the end so i can fix that this is kind of like an email that's going to be going to bill so he can review it so he's going to see this and i'm just going to say looking to make the home page title look better or something along those lines okay so now that i've done this i can just go ahead and click create pull request there cool it says that the pull request for the branch adjust title and startup has been created and it's pull request number one or as the kids call it pr1 pull request one okay so when you see these numbers here github creates those for you so with that said uh bill do you want to come back yeah definitely okay let's check out what you've been working on as the original author of the code github will notify me as to the fact that a new poll request is coming in now you can set up your notifications in github and there's a whole other conversation you can have about that i'm not going to cover that in this video but i do receive emails and i also get notifications on my app on my phone so you can see here there's this pull request and it's telling me what files were changed which is just one of them and it also allows me to see the differences between the files but that's just direct links inside of the email that i received let's take a look at github before we do this in visual studio here we see my list of repositories i'm just going to go right into here but i will point out that there is a bell icon so you can see any of your notifications but i'm going to go right into the repo that we've been working on and you can see there's a number of tabs at the top and one of the tabs says pull request and there's a number one next to it i'll go ahead and select that and here you can see there is that add h1 tag that the user requested if i go into it i can see here's the person i can see this person trying to make the home page look better that's awesome and you can also see this is a first time contributor now of course in github i can just go ahead and merge that request automatically or i can have a threaded conversation with this person what i'm also interested in is next to this conversation tab if i look all the way to the right there's a files changed with a number one if i select that you can see i can actually review the changes so here in red is my original code where i just said hello world and in green we have hello world in an h1 tag and also in greed we have the welcome to my site text so i can immediately see what the person's recommending if i like that you can see there's a review changes option here i can write something i can comment approve or request changes so that's the workflow that you have on github at any given time what we're interested in is seeing how we can do this in visual studio so let's head over there now if you're following along with the fake github account now's the time to switch it over in visual studio so that you have your primary account listed now what i've done is i've opened my local copy of the visual studio project on my computer and so if i come down here to the main branch notice that that main branch is the only one that exists the other branch that someone else created that's my choice if i want to take a look at it so let's go ahead and do that now go to the github tab in visual studio and you'll notice that you have this item here that says add h1 tag to hello world and i see the person's avatar so before i double click on that item i'm just going to stretch out this window a little bit so we can take a good look at it and double click now here what we have is a person is recommending that my main branch gets a new branch attached to it from this other person called adjust title in startup and inside of that is some changes and if i take a look over here there's that startup.cs file if i double click on it watch what happens i'll stretch this back i can see over here on the left hand side in red this is my original hello world text and notice when i scroll both sides scroll so i can see here there's that hello world that i originally had in my code and now over here there's that hello world in h1 brackets and the welcome to my site these look like good changes so i'm going to close down this diff tab here [Music] and come back and take a look at this window okay so in here i might want to do a number of things i might want to just say i don't like this change and i could reject it i could go on here and view in github and do some of those other things that i showed you but right now what i think i'm interested in doing is trying out this code so i'm going to go ahead and choose this option which is to check out this pr1 and put it onto my computer this doesn't mean that it's going to go into my main branch it's going to go into that same adjust title in startup branch so let's go ahead and do that and see what happens what visual studio just did is it says okay now this is on your local branch and it's up to date and check that out down here we have that pr1 with the whole branch name okay and we're already checked out to it so let me bring this um side window back down a little bit here and we'll go to solution explorer and if i double click the startup.cs file and scroll down you can see those are the changes that that person recommended so that's really cool it's not part of my main branch yet as a matter of fact let's do that let's head over here to the main branch i'll select this pr1 branch and choose main and notice that we'll go back to hello world that's because i have not accepted this into my main branch so let's go back we'll click on main again and go to pr1 now what i can even do is run the code and see how it looks cool there's that hello world text with welcome to my site i kind of like it i think it's good for this change i'm just going to go ahead and accept it i really like the change so i'll come over here to where it says reviewers and i'm going to click on add your review and i'm going to say great job now notice this is exactly like the user interface that was in github see how if i click on this little tick next to submit review there's comment only approve and request changes so what i'm going to do is just approve by the way if the comment only or request changes is not highlighted for you it's because you didn't put text in here the only thing that you can do when you're uh if you if you don't want to type text approve is the only thing that allows you to do that obviously you can't comment with no text and you can't request changes with no text but you can certainly approve without text okay let's go ahead and do that after you've approved you should see something that looks like this with your name and a little green checkbox if you don't see that just go ahead and press this little refresh icon and it will refresh from github and pull down the latest information you're good to go now here's something that's interesting notice how it still says the pull request is open why is it still open well this person is requesting that i move this to the main branch so after i add it to the main branch this will automatically close i may not want to do this this might be a great feature that i have approved but i'm not going to add it until i work on some other features on my project but let me just show you how this automatic approval works what we're going to do is go to the get menu and then we'll choose manage branches now what i'm going to do is right click on the main branch and check that out this is something you should be familiar with from previous videos now we want to take this branch and merge it with main notice that it was put into this pr folder nicely for us so it's sort of separate from our own changes that we're making on our branches okay so i'm going to just right click on this and choose the option of merge pr1 yada yada into main so go ahead and select that and it's saying are you sure you want to merge i'll say yes okay and the commit was made let's just close all the stuff down here it's going to close it all down and i'm going to go to the solution explorer and i'm just going to make sure that i am still on the main branch which i am if you're not just go ahead and select it okay now let's open startup.cs and take a look at the code there we go the code is now in my main branch and if i run it of course i will see that change now let's go back to the github tab and i'll notice that it still says open and if i refresh this change the pull request rather you can see it still says open what's going on how come that hasn't uh updated well that's because we only made this change on our local computer remember git and github they're distributed systems so you have to decide when you are going to make these changes on github so if we come down here once again you'll notice our little one with the up arrow and if i click on that i can go ahead and push that up to github now when i come to the pull request and refresh you'll see it says merged and if i go up here to the top of the github tab and choose pull requests you'll see there are no open pull requests now if you still see one that's probably just because you need to do the refresh so just click that little refresh icon and it will disappear in my demonstration i showed someone forking the code making changes and then going through the pull request process but you don't have to do that now i'm not going to go through the entire process again but what i am going to share with you is how you could set this up if you want the person inside your repo so what you do is go over here to the settings tab go to manage access and then invite a collaborator and once you've invited that collaborator you can see that they've been invited and it's pending an invite the collaborator will receive an email that looks something like this then you can click view invitation and then you'll notice there's an accept invitation option notice also it's providing you the information that you need to know about your security so who can see what okay so i'll go ahead and choose accept invitation and now you can see at the top of the screen it says you now have access to bill raymond's repository now rather than forking the code that user just needs to log into visual studio and this time you can go to file or git and then just choose clone repository select github and you'll notice that you have collaborator repositories go ahead and clone that now you'll notice that below here we have bill raymond slash vs 2019 github collaboration remember before another person's name showed up for their account because that was a forked one this is the direct account now why is this purple down below as you'll recall when we originally did this video earlier we actually had to do a few things first if team explorer shows up we close that because that's being deprecated and the other thing is we want to come over here in the solution explorer to switch between solution views click that until you see the solution file and then double-click the file there now you'll notice that the solution is open and the bar at the bottom of visual studio is blue so now you can start working on the project just because you have direct access to the repo does not mean that everything else that i showed you should change as a matter of fact you should follow some of the practices that i shared such as creating a new branch for your new feature or change reviewing those changes and debugging them then finally committing those changes and sending a pull request visual studio 2019 will know who the repo owner is so when you send a pull request it will automatically go to them i'm not going to cover these in great detail but i think it's important to talk a little bit more about these pr's these pull requests i'm going to open one up here and i created that one earlier and i'm going to go back to this add your review option now if you'll recall under the submit review option there's a comment only this is a way for you to converse with the other developer for example let's say that you understand the code but have some questions and you can ask them here now do keep in mind that there's a very good chance that anyone on the repo will be able to see this commented discussion thread as a matter of fact if your repos not private pretty much anyone can go in and see these things so just keep that in mind of course the security settings and all that but keep in mind that this is kind of an open thing that people can can read the other thing that's important to note is that if you chose request changes that's actually a good way to start driving home important ways in which your repo gets coded so for example let's say that i am a owner of a repo i sir i code a certain way for example this person saying oh i want to change the text from hello world to hello universe i could say we always capitalize headings or something like that and so rather than me going in and making the change for them i'm going to send it back i'm going to say i'm re requesting changes because i want that person to get familiar with how my coding standards work now earlier in this video i mentioned that github provides a lot more collaboration features for example people can come over here and log bugs or issues they can even come over here and help manage your project by creating a kanban board there's lots of ways that you can collaborate with people but i want to point out that pull requests are the only features that work inside of visual studio 2019 so you might be able to pull up an issue technically in visual studio or pull up the project but really what you're doing is just punching a browser window into visual studio 2019 so just be aware that the big collaboration feature that visual studio 2019 provides is pull requests i do hope in the future that microsoft incorporates issues and projects and any other collaboration features directly into the product thank you for watching this video if you want more like this please like comment and click the bell to support my channel
Info
Channel: Bill Raymond
Views: 1,582
Rating: undefined out of 5
Keywords: visual studio, visual studio 2019, GitHub, pull request, pr, collaboration
Id: Wdc56jf3yxM
Channel Id: undefined
Length: 34min 27sec (2067 seconds)
Published: Mon Jul 19 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.