WHY GIT?
Git was created by Linus Torvald's. He is a software engineer who is the creator and lead developer of the Linux kernel since 1991. Git was created with the following things in mind :
- Speed
- Simple design
- Strong support for non-linear development (thousands of parallel branches)
- Fully distributed
- Able to handle large projects like the Linux kernel efficiently (speed and data size)
Like most solutions, necessity breeds innovation. Before Git version control, managing files was very hectic for most teams, leading to situations where developers had to duplicate their own files and create versions, e.g., final_v1.zip, final_v2.zip, and so forth.
This then brings us to the crux of this article. In this article we will explore what git is, the difference between git and GitHub and it will also serve as an instructional tutorial on how to use both git and GitHub.
Additional information for this article;
- This is a beginner level article. We will cover the main uses of git but will not dive into advanced techniques.
- By the end of this article, you will understand git, GitHub, the difference between git and Github, create repositories, make changes and use branches.
- I am using MacOS and ITerm but will provide windows alternatives where necessary.
WHAT IS GIT?
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
So basically, Git helps you manage your work the way a well-organized notebook or photo album does. Imagine every time you make progress, you don’t overwrite the page; instead, you neatly save a new page with a note about what changed. If you don’t like today’s version, you can flip back to yesterday’s. If you want to try a risky idea, you open a new page instead of scribbling over the original. Git does exactly that for your files: it keeps a clear, navigable history of your work so you can experiment freely, fix mistakes instantly, and never lose track of how you got from “first draft” to “finished.”
At its core, Git:
- Tracks changes to files
- Records those changes as commits
- Allows you to move back and forth through history
- Lets you work on different ideas in parallel using branches
WHAT IS GITHUB?
GitHub is a cloud-based platform where you can store, share, and work together with others to write code.
Whereas Git is the underlying technology, GitHub is a platform built on top of Git that makes it easier to store code online, collaborate with others, and manage projects. Git itself works entirely on your computer and is responsible for tracking changes and history, while GitHub simply uses Git to provide a web interface, hosting, and collaboration tools.
Importantly, GitHub is not the only platform powered by Git; there are several others that work in the same way, including GitLab, Bitbucket, Azure DevOps, SourceHut, Gitea, and self-hosted Git servers. Once you understand Git, switching between these platforms is mostly a matter of learning a new interface, not a new technology.
You can use Git without GitHub but you can never use GitHub without Git.
Additionally, Git itself is free and open-source, meaning anyone can use it without paying, while platforms built on top of it, such as GitHub, Bitbucket, GitLab, and others, offer free tiers but also have paid pricing models for advanced features, storage, or team collaboration.
INSTALLING GIT
If you’re on macOS and use Homebrew. Type this into your terminal:
brew install git
Next let's verify the installation.
git --version
Now that we have git installed, let's create our first repository. I will be using GitHub to demo this . A repository is just a folder that git is tracking .
Let's head over to GitHub
If you haven't already, create an account by clicking on sign up and following the steps. If you already have an account log in.
You can follow this tutorial from the docs in case you have any issues
Once logged in, create a new repository by clicking on the button labelled New
It will lead you to this page asking you for a name for your repository.
Give your repository a name and click on the create repository button.
Once you click Create repository, GitHub will take you to a setup page. Here you’ll see different connection options, most commonly HTTPS and SSH.
HTTPS uses your GitHub username and password (or a personal access token). It’s easier to get started with and works well for beginners.
SSH uses an SSH key stored on your computer. Once it’s set up, you can push and pull without entering your credentials each time. It’s more secure and commonly used by developers long term.
Both options do the same thing they let your local Git repository communicate with GitHub. If you’re not sure which one to choose, start with HTTPS.
This article explains SSH vs HTTPS in more detail.
Once the repository is created we will clone it into our machines. I'll be using iterm for this part and cloning via SSH.
Click on the copy to copy the url and let's head over to iterm and clone the repository by using the command git clone and the SSH or HTTPS url of your repository.
When we do an ls in the directory where we cloned our repository we should now be able to see it.
We can now navigate into our cloned repository using cd name-of-repository e.g mine will be cd github-101. It should show us the repository and its current branch.
We can now open VScode to continue the rest of the article using code .
At this point we do not have any files to track as this is an empty git repository and we have not yet added any files for git to track.
This is also evidenced by the source control icon on git which currently doesn't show any tracked changes.
Additionally we are able to see that we are on the main branch as shown by the screenshot below.
Let's now create a test html file that we can use to learn how to add, commit and push to a branch .
We notice two things after creating the file. The first thing is that it has a U on it meaning it's an untracked change. The second thing is that VsCode's source control shows one new file added but the U tells us that it is untracked.
This is the status of our current branch and we can show it using the command git status on terminal.
It shows us the branch we're on, if there are any commits and which files have been tracked.
In order to track this file we use the command git add name-of-file. In this particular scenario it will be git add index.html
We can see that the U of the untracked file has changed to A .This means the file has been added to the git staging area. We can confirm this by doing a git status.
This now shows our file as changes to be committed. A commit is like a save point in your project.It records a snapshot of your files at a certain time, with a message describing what changed.
We will now commit our changes using git commit -m "Message to be commited "
Once committed, you will notice the file does not have an A or a U showing that all changes have been tracked and committed. We can do a git status again to see this.
We see that there's nothing further to be committed and can now push to the upstream on GitHub. To push we use the command git push name-of-branch
Let's head over to GitHub and we should be able to see our new file added to the repository as well as the commit message we used.
We have now successfully created a new repository, cloned it, added changes, committed them and successfully pushed them to our repository on GitHub.
A few resources that have been useful as I was writing this article were ;

















Top comments (0)