Suggested playlist while reading this post.
In today's post, we will cover two very important concepts: Git and Github. While they do sound similar, they serve two very different purposes. Git is an open-source version control system (in layman's terms, it allows you to monitor and track your code). On the other hand, Github is a website (and a cloud-based service) that help programmers manage, store, track, and control changes to their code.
What is Git?
We all know how difficult it can be working within a team - especially in programming with so many moving pieces. However, Git is a tool that overcomes the issues mentioned above. It allows multiple programmers to monitor and track different versions of the codebase (you will still have to deal with your passive-aggressive colleagues, though...).
Git does something special, it tracks all the data that has been amended. A better way to explain it: imagine Git saveing/storing information through a series of snapshots. No, Grandma, Git doesn't take literal photos of the code, but it does act in a similar concept. Every time we save the project, Git (being a smart apple) takes a picture of all your files at that moment in time and saves a reference point to that snapshot.
To break it down further, it keeps track of all the data that have been amended. Additionally, it tracks who did it, what they changed and when they changed it. And this is what you call version control. Let's not forget that with Git, you can also share your code with collaborators using GitHub.
While Git is a command-line tool operating locally, Github is a Git repository hosting service for developers to host code and their versions (under Git management). It makes code sharing and collaborating easier. Also, you can find a lot of open source projects on it where you could contribute.
Imagine a massive website like Facebook. Suppose a software developer wants to implement a specific change to the codebase of Facebook. In that case, we can assume it would be very dangerous to alter the code directly within the codebase.
Instead of editing the source code directly, GitHub provides some nifty tools for us.
- branching (forking)
Branching allows the programmer to copy the code from the original codebase and implement changes to the copied code without affecting the original code.
Once the developer carries out the desired revisions to the copied code, they can merge the altered code to the official source code. Below is an example of how branching (forking) would work.
Both Git and GitHub provide useful utility for the developer. Git provides a snapshot of the code as it goes through iterations. On the other hand, GitHub allows a programmer to implement changes to a duplicate version of the source code through branching, which can then be merged into the official codebase.
That's all for now, folks; the next blog will cover Ruby programming basics.