Git And GitHub To 5-Year Olds

Taufeeq Riyaz
4 min readNov 7, 2022

--

In this blog, we’ll go through the basics of Git and GitHub like a 5-year-old is reading this. (Assuming you’re a 5 year old who writes code)

So you’re working on a project and you removed a piece of code thinking it won’t make any change to your program and saved the file, you were very sleepy so you shut down your device and go to bed. The next morning, you literally have no idea why your code isn’t working and you don’t remember what was the piece of code you removed last night. This is exactly why most developers use a version control system like Git.

Git keeps track of all the changes when you’re working on a special kind of folder called a repository (also known as “repo” by the cool kids). Once you write your code and save the file(s) you commit the files, which basically means that you’re taking a snapshot of the entire code at that point in time and creating a version of your project. Every time you commit changes, a new version gets created in the timeline. This timeline of commits is known as a branch. You can add text when you commit as commit messages to know what changes you’ve made, although I like to add jokes so the other programmer can laugh and get annoyed at the same time (please don’t do this lol). If you ever mess up the entire project, you can always go back to previous versions (commit history) and restore all the code.

Basically, Git prevents the following from happening —

Now that you know what Git does, let’s learn some terms that’ll be useful for further understanding -

Git Pull — Pull just pulls all the files from cloud hosted repository to your local machine. In simple terms, downloading your files from your repository.

Git Push — Once you’ve written your code, you want to upload it back to the cloud, now you use git push to upload all the files from your local machine.

Pull Request — Pull requests are a process for a developer to notify team members that they have completed a feature. Once their feature branch is ready, the developer files a pull request via their remote server account. Pull request announces to all the team members that they need to review the code and merge it into the master branch.

Fork — You copy others' code. yeah, that’s it. Fork is when you clone the entire files to your new repository, this is done for various purposes, mainly to make changes to a project without affecting the main project orrrrrrrrrr the assignment submission is due in 12 mins and you want to submit a month-old assignment.

Okay, now you know how to use Git, you’re pumped up and start using Git in all of your projects, then you continue writing your program in C. Later that day you find an error and after spending 2 days finding the error, you realize you just missed a semicolon in one line, this frustrates you so much that you break your computer.

and now, you’ve been asked by the professor to submit your progress till now, (lmao).

This is when GitHub comes into the picture, GitHub is a place to store all your code and repositories online so no matter what happens, your code is always safe on the cloud. GitHub is also used to make your code Open-Source which basically means anyone can see the code of the project you have worked on and can copy the code without realizing even you’ve copied the code from somewhere else.

That’s all for Git and GitHub for 5-year-olds.

:)

--

--