Hey guys in this video we'll be looking at how you can go about adding your projects which would be
in Visual Studio to get help for source control purposes.
Now GitHub has been around for quite some time as at the time of this recording it is owned by Microsoft
and it is a development platform geared towards promoting open source.
Open source essentially means that you're sharing your code you know you have a project you worked on.
You want other people to partake in it maybe add to it.
You know that's what gets up promotes.
And so by using GitHub you can actually have a safe place to share your food or post your code just
thinking it's like you have any technical difficulties your machine goes down or anything like that.
You know it's here in the code that you can just download all of your latest work and continue.
It also does version control which means that for each change that you make you can actually check in
that portion and if something goes wrong you can roll back to the previous working portion.
And so it's very flexible it's perfect for Team coding.
And even as an individual you can reap many benefits from using it.
So you get to get old by going to it gets up com and then you will be greeted with this landing page
you can opt to sign up if you don't already have an account and it's pretty easy just the user name
and email address and password and you can see that I already have an account so I would just sign in
and this would be my account no.
I usually use this for academic purposes.
So today we want to get our school management project that we've been working on.
And here it is we want to get this up on github.
So at the time of creating this project to probably take it out to source control you probably didn't
either way as you'd been going along you'd have noticed that little padlocks and red takes beside my
files.
This is an implicit or inherent source control mechanism given those by visual studio where we can actually
check our versions right here on our own local machine and Visual Studio is allowing us to see what
has changed since the time the file has was created or since the last version of that file.
Right.
So up until now we haven't checked in anything all of our ticks are there.
If I expand the controllers for you to see that we've made changes to all of these controls so all of
them have ticks know what we want to do is actually checking all the changes that we've made.
Best practice of course would actually have us do shorter clones of chickens as opposed to building
or to hold a feature or a whole host of features and then ticking you would want to probably a chicken
per feature so that if anything went wrong you can always roll back and have one less feature than you
did before the thing went wrong.
Right.
So now I'm going to show you two scenarios.
You're either in scenario one where you didn't click at the source control and then your project would
look like this or this is another project that I have and you'd see it has no ticks nose no padlocks
and don't hear it is either project to source control.
All right so if you're seeing this ad the source control then you can just go ahead and take that and
you should see.
If you don't see it it probably means you did not install the gate function in Visual Studio.
So you want to go back to your visual studio installer and make sure you select get in the list of options
that they give you but you can just go ahead and click it and that would create a local repository on
your machine that would allow you to do version control and tracking right here on your machine.
So this is processing for a while.
Ultimately what we're aiming for is that once you have done that successfully then you should see changed
to something like this where you see the gate symbol is the engine behind the source bunch.
So there is a source control engine called Gate and this is the engine behind see get hub big buckets
on quite a few others even as your dev ops formerly known as Office Online even as your dev ops is pushing
that gets into art.
Once you've added it successfully as a local repository then you should see something like this and
you'll start seeing those padlocks and locks and and those ticks beside your files would have asked
you to make sure you see all changes before we continue.
And then in the team explore what you will see.
I have quite a few here so you may not have this extensive list on the your local gets repositories
and repositories section.
But for me I have the option of a zero dev ops and GitHub.
So a desert of ops is also free you can sign up for that one.
You'd need a lot of icons to get through with this one but Toby Toby's open to everybody regardless
of if you have a level codes or not.
So that's why I'm using GitHub and either way Microsoft owns both.
So it's becoming more homogenous as we go along.
We can always go ahead and see connect.
And if you're not seeing gets then once again you will probably want to check your your visual studio
installer and make sure that you have the visual studio tools for it ghetto.
I want to show you guys a nice easy way to get started.
You can right click on your solution and then we go to commit.
So I have a few changes that need to be committed.
Committing means that you're actually going to send these changes to the source lunch all year.
You're making a check you're checking in code literally right.
So I'm going to submit all of these changes to my repository so I right click on the solution and advise
you do it at the solution level so that everything that falls on the needs in the project or projects
will get checked in each time.
So it does right click that you go to commit and then that changes the menu to ask you which branch
master is the default branch and you have to enter a message or the purpose of a message is to let your
team know or even you because maybe you look back at it.
I wonder what change was made here.
All right so you just put in a comment to see or what new features were added.
So let me just do that quickly.
OK.
So you can see that my comment is quite long and there are things that I did that I'm not capturing
here I said in the beginning that it's kind of bad practice to be checking in code after a very prolonged
period.
So you'd want your comment just to tell the whole story.
And also in order to tell the whole stories bits of short stories then have one big story and then try
to capture it all in one big epistle or right.
We have added controllers since the start of the project.
We have added the data model and we added useful authentication functionality of course with each of
these changes what we would want to do is spell out OK this is what was done this change.
This was all was done for that change right.
So once again by practice here but I'm teaching you as you go along so you learn for your own purposes
not to do it.
And then you see come it's all and you'd be tempted to dislike it but once again I want to show you
the simpler we can go and this don't it and commit all and sync.
So what sink would do know is ask you okay come all to the local repository and you want to sync it
with where exactly.
So because we don't have a remote repository which would be one of the zero dev ops or ghetto bar or
otherwise it's asking us where do we want to sync it to.
All right.
So in order to facilitate this sync what we would do is just connect to GitHub so we can just go ahead
and connect.
And then this will prompt us to sign in with our user name.
So the.
Quickly and then once you sign it with Utah we'll see all of our repositories listed.
OK.
So after connecting to get hub here in Visual Studio What do you want to do is go to the home and click
sync and then one day I will ask you is it will give you the option.
To get up so you can just publish the ghetto and then we'll give you a tiny menu where it just validates
allows it to change these if you want you can change the name of the repository as it would appear on
GitHub so you can just see.
School of Management or you can add a short description here.
So the project so I'm not a typo is a good description.
Is I putting in a good description here created for the Udemy course.
Learn you've done it MVC with entity framework database first does that's the course that this video
is associated with then.
So this this serves the purpose of letting anybody who stumbles upon the code have an idea of why this
was created or what it's for.
You can opt to have it as private or public private means not the whole world won't be able to access
that code.
Public means that well the whole world can access that code if they go on gets up and then you can just
publish all right.
So once that action is completed you'll see another change heroes show you the direct link to your repository
there on GitHub dot com.
So if you click that to navigates your browser to that they'll also give you the ability to manage a
few things from GitHub right here in visual studio so you really don't have to go to the Web site much.
After just creating your own thread.
So if I go about though and I refresh here then I would see that I have the repository as was promised.
All right.
So I can go to school management and then it will let me know that four whole commits were made because
what happened was that I on my computer I was making comments to my local repository you might not have
been so you would see probably one comment made but all of mine that weren't being made locally were
all pushed to GitHub so GitHub has the same record of changes.
Know that my local repository had as I was going along going along using it only locally.
So here you see the code and if you follow this thing you would be able to see this code.
At any rate you know using getup which allows you to share it with facilitators or your friends and
share whatever it is you're trying to do.
If if you're attempting something and you know it's not working out you can just send it to github somebody
to check on its though it is ill advised to chicken or commit code that doesn't work.
So I would advise you that if it hits ghetto it should be operational meaning if I come along some blow
up on it then try to download it and I can always either clone it and get the source files synchronize
with my visual studio or I can just don't load it in a zip.
Or just as the owner I can open invisible visual studio or I can just download the zip here as as a
passer by and have the project as you would have uploaded it.
So that's how you get your code of the ghetto.
GetUp is very cool it is very powerful and I hope you get through this exercise pretty well if you have
any difficulties feel free to drop me a line and let me know.