๐Ÿ™DevOps

Git & GitHub Explained: Version Control for Beginners

Learn why developers use Git and GitHub to track code changes and collaborate, including all the essential Git commands.

Mohamed Mydeen

Mohamed Mydeen

Full Stack & AI Engineer

September 3, 2026
12 min read
#Git#GitHub#Version Control#Beginner

1. What will we learn?

We will learn what version control is, why it is the backbone of modern software development, the difference between Git and GitHub, and how to track and push your code using essential Git commands.

2. Why do we need this?

Imagine you are writing an essay. You save it as essay_v1.docx. Then you make changes and save it as essay_final.docx. Then essay_final_REALLY_FINAL.docx. It becomes a mess.

Now imagine 10 developers trying to edit the exact same code file at the exact same time. Without a tracking system, they would constantly overwrite each other's work and lose progress.

3. What is it?

  • Git: A software tool installed on your computer that acts as a time machine for your files. It tracks every change made to your code.
  • GitHub: A website that hosts your Git tracking history in the cloud, allowing multiple developers to collaborate and share their code.

4. Simple analogy

Git is like the "Save" feature in a video game that remembers exactly what you did at a specific checkpoint.

GitHub is like "Cloud Sync" for those save files, letting your friends download your save file and play from where you left off.

5. How it works

Your code goes through a specific journey:

1. Working Directory: The files on your computer.

2. Staging Area: Files you have marked to be saved.

3. Commit: A permanent "snapshot" or save-point of the staged files.

4. Push: Uploading that snapshot to GitHub.

6. Step-by-step practical example

1. Create a new Git repository (folder tracker)

bash

2. Download an existing project from GitHub

bash

3. Check what files have changed

bash

4. Add changes to the staging area

bash

*(The . means "add everything")*

5. Save the snapshot with a message

bash

6. Upload the snapshot to GitHub

bash

7. Download the latest changes from GitHub (if someone else pushed code)

bash

8. Create a safe copy (Branch) to experiment on

bash

7. What just happened?

Developer โ†’ Writes Code โ†’ git add โ†’ git commit โ†’ git push โ†’ GitHub.

This is the universal workflow of almost every developer in the world. By putting the code on GitHub, our DevOps CI/CD pipeline (which we will build later) can automatically detect new code and deploy it!

8. Common beginner mistakes

  • Committing secrets: Never commit a file containing passwords, API keys, or AWS keys! They will be public on GitHub. Always use a .gitignore file.
  • Forgetting to pull before pushing: If your team pushed code while you were working, you must git pull to merge their work before you can git push.

9. Interview questions

Q: What is the difference between Git and GitHub?

A: Git is the local version control software; GitHub is a cloud hosting service for Git repositories.

Q: What is a Pull Request (PR)?

A: A formal request to merge your branch (your changes) into the main branch, allowing team members to review the code before it becomes official.

10. What we learned

We learned that Git tracks changes to files over time, and GitHub acts as a central hub for collaboration. We learned how to move code from our computer to the cloud using add, commit, and push.

11. What's next?

Before we put our code on the internet, we need to understand how the internet actually works. In Article 4 โ€” Networking Basics for DevOps, we will decode IPs, Ports, and DNS!

0 Claps

Limit 50 claps per article

Mohamed Mydeen

Mohamed Mydeen Shahabudeen

Full Stack & AI Engineer

Building AI-powered products and writing about the engineering behind them. Creator of Mydeen AI, Feast At Night, and SafeCheck.