Explaining Git and GitHub To an Eight Year Old

Written by codesmith.staff | Published 2019/01/19
Tech Story Tags: github | git | beginners-guide | web-development | hackernoon-top-story

TLDRvia the TL;DR App

You’ve probably heard of GitHub as you’ve explored the expansive programming world. People keep saying that you need to use it because tons of people use it and your future employers will like to know that you use it. And so you’re thinking about using it but you don’t even know what it is. Or perhaps you do know what it is and can’t quite explain it. Then there’s this Git thing that sounds similar to GitHub. They’re two completely different entities.

We’re going to help you by explaining what Git and GitHub is to a eight year old.

Git

Imagine you’re eight.

You love playing with Legos. You’ve built castles and forts and ships out of Legos. But you’ve always had to take your Legos apart because your mom always tells you she doesn’t have space in the living room to keep your toys.

Then one day, your mom bought a shelf to save your toys. So now you can keep whatever you save. She even gave you stickers to give names to your Lego projects. That is Git, my friend. You get to save your own projects in your own hard drive and write comments about your code.

git add allows you to add Legos to your shelf

git commit allows you to save your Legos. It’s like telling your brother or sister not to touch your Legos.

Github

Now, say your mom buys you a giant Lego set for your birthday that allows you to build New York City. That might take years for you to build if you work on your own. So you tell your mom that you want your friends to help you build it. Your mom doesn’t want you guys making a mess so you decide to build the Lego set in the park. That’s the “Hub” part of GitHub. You can take your code or your Legos to Github and share it with everyone.

git remote add origin [https://github.com/YOUR-USERNAME/legos](https://github.com/YOUR-USERNAME/legos)

Those who want to use your code will fork your code. That just means they’ll copy the code so that they can work on it on their own. It’s almost like someone borrowing your Legos so that they can build something on their own. Except…you don’t have to lose any of your own Legos. They get to clone your Legos.

git clone [https://github.com/YOUR-USERNAME/legos](https://github.com/YOUR-USERNAME/legos)

Isn’t that cool? Now your friends can work on what you’re working on. So one friend can focus on building apartment buildings and another friend can focus on office buildings. When your friends bring all the pieces together, you will have a completed Lego set. That’s what’s called pushing code.

git push origin master

You will pull up the pieces after they’ve pushed them to you. Either you or they will submit a pull request, which is like your friends asking if you like how they built their Legos. If you like it, you’ll accept the pull request. If you want them to fix it, you’ll reject the pull request.

Conclusion

That’s GitHub in a nutshell. The process of pushing and pulling code is called version control. Every step of the way, coders ensure that their version is the latest version. Sometimes, if you mess up the code, you can even go back to earlier versions of the code to erase the mistake. In this way, there’s rarely a “Dog Ate My Homework” situation when you’re using a version control system like GithHub.

Of course, you always have to make sure to commit and document changes so that you can take full advantage of GitHub. There is so much more you can learn about GitHub beyond this very basic understanding. We’ve left resources here that will help you gain a deeper understanding of Git.

Resources

GitHub’s Tutorial On How To Use GitHub:

https://guides.github.com/activities/hello-world/

Git and Github Video Tutorial:

https://www.youtube.com/watch?time_continue=211&v=SWYqp7iY_Tc

Hubspot Guide For Beginners(Installation Help):

https://product.hubspot.com/blog/git-and-github-tutorial-for-beginners


Published by HackerNoon on 2019/01/19