Have you ever played a game without a memory card? ( I’m talking Playstation 1 times) If you did, you really liked to live dangerously and I would be extra cautious around you because your decision making is questionable.
If you’re not a gamer, what usually happens when one plays without a “memory card” is that when the player turns off the playstation console, any and all the progress they have made in the game is forever lost and they would have to restart all over again. Doing so is like doing this:
However, if a gamer used a memory card, they would be able to retain all the progress they’ve made as it would be saved in a file, which can be accessed the next time the gamer turned on their gaming console.
That’s more or less my analogy of Version Control.
What is version control?
It’s a system that records changes to files so that if ever the situation calls for it, you’d be able to revert to previous versions of “saved” progress.
Say you sat down one evening and you coded a navigation menu that was red, a footer section that was blue, and set the body text to a font-size of 22px. You were very happy with your progress, so you upload the project files on github and call it a night.
While you were sleeping, unbeknownst to you, your cat — who is set in ruining your life — accessed your text-editor and locally changed your menu to blue, your footer section to red, and set the body text to 100px then uploaded the edited files to github.
You wake up the next day and are pumped to work on your project, when you’re hit with the new styling of your website. But because you’re smart and uploaded your files to github using git, you were able to revert your files to your original code regardless of the local changes that your cat made.
Eyyyy!! you’re happy and your cat’s schemes didn’t phase you. But oh no!
He swipes your morning coffee with his tail and the coffee spills on your laptop and fries the circuits. Now you can’t access your local files! you’d have to start your project all over again! Nope.
What is Github?
It is a web-based app, which stores your projects / files in repositories
Not all hope is lost because you were smart by storing your local files on Github! You slap your cat on the paw, get a new a laptop, use git and github to access and download your saved files and wallah! it’s as if you never lost progress.
But because you bought a new laptop, your budget for cat food hits an all-time low. The cat seeing his dire situation decides to help you finish your website faster for that extra money.
This is when your cat creates his own Github account and helps speed up your progress.
What else can Github do besides save my progress?
Github allows you to collaborate with other developers
While you were sleeping, he used his own laptop — or cattop — “cloned” a copy of your project files into his local desktop and started coding ( sidenote: doing this does not mess up your previous history or currently saved file, he merely cloned a copy of your currently saved file into his desktop ).
Before you even woke up, he developed the about section, contact page, and used CSSGrid to display your client’s portfolio responsively — and mind you, doing all this faster than you could ever damn code. He’s happy about his progress and “pushes” his changes to your Github and goes to sleep.
You wake up, you log in to your Github account and you notice that someone by the username of CodingRightMeow pushed his changes to your project. You review it and to your astonishment, it is code that is better than anything you could ever damn code.
You accept the changes and both your files merge into one completed project. You get paid and you celebrate your hard-earned cheque by buying brand-named cat-food.
Client happy. You happy. Most importantly, cat happy.
What is Git?
If Github is a library of your projects, Git would be the librarian.
— — or — —
If Github is the memory card, git would be the playstation system that is in charge of saving / reverting all progress.
Of course, this is a generalization of what git is.
This is my fun take and attempt to talk about this topic and answer the what and the why to version control. I have plans to publish a tutorial on how to use git and github for web development really soon.
Note that this is not meant to be an exhaustive resource on the topic. It is not a comprehensive tutorial on their full capabilities and functionalities.
It’s my hope that this helps at least one person understand the basics of github and git in lamens terms.
Additional and amazing resources on github:
This “publication” is called Power Up and I hope to have empowered your learning.
You can support me in different ways: clapping, sharing my posts, inviting me to guest feature in your Medium, commenting, or by hitting that follow button. If you’re feeling generous, keep me awake by buying me a cup of coffee. :)