In this blog i will tell you a github guide 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. In this video,
I'm going to show you how to get setup 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. To get started with GitHub,
Accessing GitHub
we need a GitHub account. 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. Then, go ahead and get signed in to GitHub. 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. You can just access it 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. Once we get logged into GitHub, the first thing that we're going to do is - over here
Creating a Repository
on the left is where all of our repositories are going to be listed. You can see that I have one repository right now and it's a game that I was working on about a year ago. 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. We'll just call this "githubtest". 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 a good idea to at least have one file with any repository so you can choose to initialize the repository with a readme file. Go ahead and do that and then, when you're ready, go ahead and click create repository. Now, we can, 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. Once you create a repository in GitHub they will be listed. Anytime you go to the home page,
Viewing Repository List
they'll be listed over here on the left. You can see I clicked on the home page and now, in addition to the "livealife" repository, I also have the GitHub test repository. By clicking on a repository, I can see all the information about of 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. 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 sort 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,
Installing GitHub Desktop
if you go to desktop.github.com, you can download the local version of GitHub. You'll notice that,
for me, it's offering me the Mac OS 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
Cloning a Repository
Locally going to go back to your repository on GitHub .com. So, here I am - I'm just on the main repository page. 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. 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". Now, we've just cloned the repository that we created on GitHub and we have connected it to the GitHub desktop application. Now, if we make any changes to the files in this repository, we will then be able to commit them to the master. Let's take a look at how this would work.
Committing New Changes
I'm actually 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 "livealife" repository connected right now to the GitHub desktop application. 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, I'll just do a space - it doesn't even really matter what the changes are. 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 has 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. We can just call this quick update. And then, of course, we would also give it a description. Be very descriptive on everything that was done with the code so that any other developers working on the project know exactly what wasdone and why it was done. Then, when we're ready, we would go ahead and click on "Commit tmaster...". It's saying that it's going to make two commits to the origin remote. Which is what is stored on GitHub. 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 we're to then pull the files down from GitHub, they would have the latest files. If we go back over into GitHub in our browser and we go over to the other repository...
Viewing Commits on GitHub
I'm just going to go to the home page and I'll click on the "livealife" repository Notice that we now have, listed right here, that there was an update called quick 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
Outro
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. I hope you found this video helpful in getting a repository set up on GitHub.com and getting the local application downloaded / 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 easily integrate it .
0 Comments