Sitemap

Version control, Git, Github.

8 min readOct 1, 2025

--

Press enter or click to view image in full size

Put a finger up if you’ve ever saved your project files as “Final”, “Final Final 1”, or even “Officially Final” just because you kept making changes and wanted to keep different versions safe. Yeah… I see hands up, mine inclusive.

Okay, Let’s dive into understanding version control, Git, and GitHub, and why they’re a lifesaver for anyone working on projects, big or small.

What is Version Control?…

Version control, also called source control, is the practice of tracking and managing changes to your source code over time. Think of it like a history log where every change is recorded. With version control, you can review what was changed, see who made the change (in team projects), and even roll back to an earlier version whenever you need to.

Now, how do we actually keep track of changes in actual sense?. This is where Version Control System (VCS) comes in. Version Control System is a software that manage and keep track of changes that happens to a file overtime, it also provides us with the luxury of rolling back to a previous version of a file. There are types of version control systems;

  • Centralized Version Control System: In a centralized system, there is a single central server that stores all the files and their version history. Team members connect to this central server to get the latest version, make changes, and commit updates. Think of it as one shared source of truth that everyone works with. The downside? It has a “single point of failure”. If the central server goes down, no one can access the latest version, older versions, or make any changes until the server is back online. Examples of Centralized VCs; Subversion (SVN), Perforce, and Concurrent Versions System (CVS)
  • Decentralized/Distributed Version Control System: In decentralized system, each contributor has a copy, version and history of the file in their local machine, this way, collaborators can make changes, roll back to a previous version and work independently before merging or pushing updates to a shared remote repository. Example of Decentralized VCs ; Git

Now, let’s dive into the most popular type of version control system: Git.
From what we’ve discussed so far, you already have a sense of what Git is. But just to reiterate, Git is a version control system that tracks and manages changes to your source code/code/files. It allows you to roll back to previous versions if needed, and it also makes collaboration easy, multiple contributors can work on the same project independently and then merge their changes together.

Another powerful feature of Git is branching, which allows you to create separate versions of a project to test or develop new features without interrupting the main project. For example, imagine your manager asks you to make changes to the company’s application’s interface. Instead of changing the main application directly (and risking breaking it), you create a development branch where you safely make and test your updates. Once everything works fine, you merge your branch back into the main project. This way, you avoid disrupting the entire application just to implement one change.

There are three main ways to interact with Git, depending on your preference

  • CLI (Command Line Interface): This is the most common way developers interact with Git, by typing commands directly into a command line interface. It gives you full control and flexibility. Examples of common CLI used; Git Bash, Terminal & Command prompt
  • GUI (Graphical User Interface): These are applications that provide a visual interface for Git. Instead of typing commands, you click buttons and menus. It’s beginner-friendly and easier to visualize changes. Examples; GitHub Desktop, Sourcetree
  • IDE (Integrated Development Environments): Modern IDEs like VS Code, IntelliJ, or PyCharm come with Git integration built-in. This means you can write your code and manage version control in the same environment without switching tools

In the process of version control and in other for git to effectively track your files, there are stages they go through, let’s look into these stages (git lifcycle/workflow) then we look into some of the important commands that help achieve these. To make it easier to understand and visualize, i will explain the commands while explaining the stage of the lifecycle they help achieve

Press enter or click to view image in full size
Git lifecycle/workflow

mkdir:
Before starting any project, you need a directory (commonly called a folder). This is where all your project files will live. In the Git lifecycle, this directory is referred to as the working directory. To create a new folder, in your CLI, you write:

mkdir your-folder-name

cd:
After creating a working directory, the next step is to move into that folder. You can think of this as opening the folder so you can start working inside it. In your CLI, you write:

cd your-folder-name

git init:
Once your project folder is ready and you’re inside your working directory, the next step is to tell Git to start tracking it. This is the initialization stage in the Git lifecycle, where Git sets up everything it needs to manage versions of your files. In your CLI, you write:

git init

Think of it as saying: “Hey Git, set up your tools here so you can start watching my files and changes”. Behind the scenes, Git creates a hidden folder called .git inside your directory. This folder is where Git stores all the history, versions, and tracking information for your project.

Get Taibat Abowaba’s stories in your inbox

Join Medium for free to get updates from this writer.

touch:
This command is used to create new files in your working directory. These are the file(s) you want to keep track of. The file(s) can be of any format, for example, .txt, .py.In your CLI, you write:

touch my_file.py

git add:
After creating your files and initializing, the next step is to prepare those files for tracking. git add moves your file(s) from the working directory into the staging area (as shown in the lifecycle diagram above). You can think of this as telling Git, “Put these files in a basket, I want them included in the next snapshot”. Don’t worry about the word snapshot yet, I’ll explain in a bit. To do this, in your CLI, you write

git add my_file.py

git commit:
Once your file(s) are staged, the next step is to save a snapshot of them in Git’s history. This is called a commit. Think of it as telling Git, “lock in this version of this file or each of these files (if the file in your staging area is more than one) so I can always come back to it later.”

git commit -m "my first commit"

Now, your file(s) are now being tracked, any changes that happen to your file(s) afterwards, git is aware of them. Remember, all of these are still in your local repository (your machine).

After this is done, you can choose to host your project in a remote repository. A remote repository is like saving your work in the cloud (Github for example), it makes your project accessible anywhere and allows others to see it or collaborate with you.

Now, how do you move your project from a local directory to a remote directory?. I think this is the part I explain GitHub. GitHub is a cloud-based platform where your Git repositories are hosted so you can collaborate with others. It provides a GUI (Graphical User Interface) meaning instead of typing commands, you can click buttons to see commits, branches, pull requests, and more.

But here’s something important to remember: GitHub is not a version control system. Git is the version control system that actually tracks changes, manages versions, and allows you to roll back to earlier states. GitHub only provides a place to store your repositories online.

Back to the question: “How do I move my project from a local repository to a remote repository?”. This is done by using a command called git push.

git push:
This command tells Git, “Take the commits I’ve made in my local repository and send them to a remote repository (like GitHub)”. But before you can push, you first need to connect your local repository to a remote one. That means you must first create a repository on GitHub. Once that’s done, you link it to your local project using:

git remote add origin https://github.com/your-username/your-repo.git

Here’s what each part means:

  • remote add: Tells Git you’re connecting to a remote repository
  • origin: The standard name Git gives your remote repository
  • URL: The link to your GitHub repository

After connecting, you push your files with:

git push origin main

In a case where you make changes on your remote repository, do not forget to signal your local repo of the changes made. This ensures your local project stays in sync with the remote repository. You do this with:

git pull origin main

We’ve discussed how to work independently with Git, but collaboration is where version control really shines. With distributed version control systems (DVCs) like Git, you can easily contribute to projects, whether it’s at work, with friends, or in the open-source community. Let’s look at two common scenarios and how you can contribute in each.

Scenario 1: Contributing as a Collaborator

In a work setting or when working with friends on a joint project, you are usually added as a collaborator. Being a collaborator means you have write access to the repository. Here’s how collaboration typically works in this case:

Clone the repository to your local machine.

git clone github-url

Typically, what this does is download the version of that repo into your local repository, you can then create a new branch to work with, make changes you want and since you’re a collaborator, you can push changes directly to the repo.

Scenario 2: Contributing to an Open-Source Project

When contributing to open-source projects, you’re usually not a collaborator. This means you don’t have write access. In this case, what you do is fork the repo, which creates a copy under your own account (a remote repo). You then clone your fork, make the changes you want locally, and then push them back to your fork. After that, you open a pull request, and the project maintainers review your work before deciding whether to merge it into the main repository.

I believe we’ve been able to cover the fundamentals so far. Of course, there’s still so much more you can do with Git, and many more commands to explore as you grow more comfortable with it. To give you a handy reference, I’ll leave a simple Git cheat sheet below. I hope you’ve found this article helpful. Until next time, be well….

Press enter or click to view image in full size
Git cheat sheet.

--

--