This post is for middle school students.
In this post, we will see how to use GitHub to checkout a project in your local machine.
Checking out means copying all the files from the server to your local machine and is available for editing.
The project that is used for this post is https://github.com/kumanan12/html5labs. When you click on the link, you will be taken to the html5labs project in github.com
Click clone or download button. You will see a popup. Click on the copy button which is highlighted in yellow below.
Then go to command line in your PC. Then type git clone and paste it in to your command line window. Or you can simply type the command as shown below.
After running this command, the source code will be copied from the server to your local machine. It will put all the files by inside a folder “html5labs ” in your current directory.
At this point, you have the source code in your local machine. You can make changes to the files or add new files.
Now You can use your favorite editor to open the project. I will use Visual Studio code in this post.
Open the folder “html5labs” in Visual Studio Code.
I am going to create a folder called test and add a file called index.html.
Commiting means to save your changes locally
In the above image, I committed my changes to the local machine. To commit all the changes, you have to click the commit button.
This means you have new version of the file locally in your machine.
If you have send the changes back to the github server, you need to use the push command.
Lets see how we can do this.
We have to use the command “git push”. It will ask for your username and password. Once your username and password is verified, it will upload all your changes to the server.
In this post, We saw how we can use github.com to collaborate in a software project by working as a team, getting the latest files from the server by checking it out, adding/modifiying files in the project, committing it locally and finally pushing it back to the github.com server.