Transcript for:
Essential Guide to Using GitHub

Hello everyone, this is Anson from ansonalix.com and in this video I'm going to show you everything that you need to know to get up and running with GitHub. GitHub is a source control platform that almost every developer uses when creating projects that involve code and committing changes. It's a safe place where you can store your project files, you can revert to old versions of your project at any time if you need to, and you can fork into new projects.

So in this video I'm going to show you how to get set up with GitHub, how to create your first repository, how to connect your repository to the local files on your computer, and how to commit your first file changes to GitHub. I do recommend that you follow along with your own GitHub account, and do remember to pause and rewind as necessary. If you'd like to jump around, there is a table of contents for this video in the description of this video here on YouTube.

So to get started with GitHub, we need a GitHub account. So here I am on GitHub.com, and if you don't already have an account, you're going to have to go ahead and sign up for an account, and then go ahead and get signed in to GitHub. So...

I already have my account that I'm going to use, so I'm just going to sign it. Now, there are a couple different ways we're going to use GitHub. First of all, we're taking a look at the online version of GitHub right now that you can just access in a browser at github.com. But of course, we're also going to use the GitHub desktop version. We are going to download that as well, and that's how we can easily commit changes from our local files to the cloud, so to speak.

But once we get logged into GitHub... The first thing that we're going to do is over here on the left is where all of our repositories are going to be listed. So you can see I have one repository right now, and it's a game that I was working on about a year ago. But if I wanted to create a new repository, I could just click on this green button right here.

So we'll just click on that to start creating a new repository. We can, of course, call this repository whatever we'd like. So we'll just call this GitHub test. We could of course give it a description if we wanted to. We can choose whether we want the repository to be public or private.

It's always a good idea to at least have one file with any repository. So you can choose to initialize the repository with a readme file. So go ahead and do that.

And then when you're ready, go ahead and click create repository. Now we can then later on attach this to the local files, connect it to the local files on our computer. So you can create this repository for a project that you already have ongoing.

And then I'll show you how you can connect the local files to it. So. we've created our first repository.

So once you create a repository in GitHub, they will be listed at any time you go to the homepage, they'll be listed over here in the left. So you can see I clicked on the homepage. And now in addition to the live a life repository, I also have the GitHub test repository.

By clicking on a repository, I can see all the information about a repository. So I can see all of the files will be listed here, I'll be able to see the last time a commit was made to the repository. So the last time it was updated, You can track issues, you can track requests, you can track almost all aspects of your project here in GitHub. So you can see insights on when files are being modified and how much work is being done. You have access to change some project settings, so if you click on the Settings section, you'll notice that you can add collaborators to a project, you can decide how branches are going to work, you can customize your notifications, all sorts of things like that.

I'm not going to go over all of those features. because I do want to show you how you can connect your local files to this GitHub repository. So great.

We've got our repository. Now what we need to do is we need to download the desktop version of GitHub. So if you go to desktop.github.com, you can download the local version of GitHub. And you'll notice that for me, it's offering me the macOS version, but you could also download the Windows version, so depending on what operating system you're using.

Now once you have that downloaded and installed, and if it asks you to sign in, you can go ahead and sign in with your GitHub account. You're going to go back to your repository on github.com. So here I am, I'm just on the main repository page. And you'll notice that I have this green button over here that gives me the opportunity to clone or download this repository. I'm going to click on this button, and then I'm going to click on the option to open in desktop.

So when I click on open in desktop, it asks do I want to open the GitHub desktop app, and I do. Okay, so when we try to clone this repository to the desktop app, we have a few different options. First of all, the...

address to this repository is automatically added in here. So we don't need to change anything in this first line. The second line allows us to choose where on our computer we would like this repository to be located. So you can either leave it as the default location, or if you already have some project files or a folder for this project, you can browse and you can choose the correct folder on your computer. So I just created this empty folder called test project on my desktop that I want to be the repository folder for this project.

So I'm going to choose that and then I'm going to click on open. And then we'll go ahead and we'll click clone. Okay, so now we've just cloned the repository that we created on GitHub, and we have connected it to the GitHub desktop application.

So now if we make any changes to the files in this repository, we'll then be able to commit them to the master. So let's take a look at how this would work. I actually am going to move over to my other repository just because I have some files that I'm working with in this repository.

So I have my live a life repository connected right now to the GitHub desktop application. And you'll notice that on the left, There isn't really anything listed. I have no files that have been changed since the last time I committed changes.

However, I do have one of these files open. So let's go ahead and move over to Visual Studio. So now I have my actual code open. And if I were to make a change to this file, so let's just I'll just do a space. It doesn't even really matter what the changes.

And then we'll go ahead and we'll just save it. So I've just made some changes to that file. When I go back over into GitHub desktop, you'll notice that on the left.

I now have a change listed. And it actually shows what I did. And I was just hitting the space bar, so we don't really have too many visual changes. But we can see what the last changes were. And we now see that we need to commit a change.

So the local version that we have on our computer is different than the version that is uploaded to GitHub. So in order to make a change, we need to go down here to the bottom. And we need to give this change a title.

So we can just call this quick update. And then, of course, we would also give it a description. We would be very descriptive on everything that we did with the code so that any other developers working on the project would know exactly what we did and why we did it.

And then when we're ready, we would go ahead and click on Commit to Master. And it's saying that it's going to make two commits to the Origin remote, which is what is stored on GitHub. And so I'm just going to click on Push Origin. You'll notice up here at the top it says Pushing to Origin. And we are now...

updating our files on the GitHub servers. So if a different developer for the project were to then pull the files down from GitHub, they would have the latest files. And if we go back over into GitHub in our browser, and we go over to the other repository, so I'm just going to go to the homepage here, and I'll click on the Live a Life repository, you'll notice that we now have listed right here that there was an update called Quick Updates. update 41 seconds ago. So we can actually see the update here on GitHub.

If we click in this folder, we could see which folder was updated last. So one minute ago, the assets folder was updated 25 minutes ago, we committed an update to the project settings folder. So there's obviously a lot of different aspects to source control that you can learn as you work on different projects. But almost any development project nowadays does use GitHub or some sort of repository, some sort of source control service. So I hope you found this video helpful in getting a repository set up on github.com, getting the local application downloaded and set up and connected to your project files so that you can commit changes on your local computer.

You can have those project files backed up on GitHub, and you can have other developers come in to take a look at your files and make comments and help you work on your project. So if you found this video helpful, I would really appreciate a thumbs up here on YouTube. And if you want to see more technology tips and tutorials, Don't forget to subscribe to my YouTube channel.

That's all I have for you for now. This is Anson from ansonalix.com.