LearnAI ToolsCareerPractice BuildsPlayDevelopmentContact
Lesson 112 min read

Introduction to Git & Version Control

Learn what version control is, why every developer uses Git, how Git differs from GitHub, and the three areas every change moves through.

Git & GitHub learning pathLesson 1 of 16
View course
On this page 11 sections

Introduction

Have you ever saved files called report-final.docx, report-final-v2.docx and report-final-REALLY-final.docx? That is version control done by hand — and it falls apart quickly. You cannot see what changed between versions, you cannot easily go back, and if two people edit the same file, someone’s work gets overwritten.

Software teams solved this problem decades ago with version control systems, and today one of them, Git, is used by almost every developer in the world. Whether you build websites, mobile apps, data pipelines or cloud infrastructure, you will use Git every working day. This course takes you from your very first commit to collaborating on GitHub like a professional.

What You Will Learn
  • What version control is and the problems it solves.
  • What Git is, and how it differs from GitHub.
  • How Git stores your project as a series of snapshots called commits.
  • The three areas every change moves through: working directory, staging area and repository.

What Is Version Control?

A version control system (VCS) records changes to a set of files over time, so you can recall specific versions later. Think of it as an unlimited, organised undo history for an entire project — one that also records who changed what, when, and why.

Full history

Every saved version of every file is kept. You can see exactly what changed between any two points in time.

Safe experiments

Try a risky idea on a separate branch. If it fails, throw it away — your working version is untouched.

Collaboration

Many people can work on the same project at once, and the system combines their changes.

Accountability

Each change carries a message, an author and a date, so you can understand why the code looks the way it does.

What Is Git?

Git is a free, open-source distributed version control system. It was created in 2005 by Linus Torvalds, the creator of Linux, to manage the Linux kernel’s source code after the team lost access to the tool they had been using. He designed Git to be fast, to handle huge projects, and to work without a central server.

“Distributed” is the key word. With older, centralised systems, the history lived on one server and you needed a connection to do almost anything. With Git, every copy of a project — on your laptop, your teammate’s laptop and the server — contains the complete history. You can commit, browse history, create branches and compare versions entirely offline, and every copy is a full backup.

Git is a command-line program. You will learn its commands directly, because that is what works on every computer, every server and every CI system, and it makes graphical tools (like the Git panel in VS Code) easy to understand. You can check whether Git is already installed by asking for its version:

git --version
Output (your version number may differ)

Click Run to see what this code prints.

Git vs GitHub

Beginners often think Git and GitHub are the same thing. They are not:

GitGitHub
What it isA version control programA website that hosts Git repositories
Where it runsOn your computerIn the cloud (github.com)
Made byLinus Torvalds and the open-source communityGitHub, Inc. (owned by Microsoft)
Main jobTrack history, branch and mergeShare code, review it, and collaborate
Works without the other?Yes, completelyNo — it is built on Git

GitHub adds collaboration features on top of Git: pull requests for code review, issues for tracking bugs, Actions for automation and Pages for free website hosting. GitLab and Bitbucket are popular alternatives that do the same job. The Git commands you learn work with all of them.

Mini Challenge · Predict the Output

Your internet connection drops while you are working. Which of these can you still do?

Choose one answer

Snapshots and Commits

Git stores your project as a series of snapshots. Each time you save a version — called making a commit — Git records what every tracked file looks like at that moment, along with your name, the date and a short message describing the change. Files that did not change are not copied again; Git simply points to the version it already has, which keeps repositories small.

Each commit gets a unique ID, a 40-character code such as 55024d88e53bccb887f0034037fc4ddfc38c8248, usually shortened to the first seven characters (55024d8). Each commit also remembers the commit that came before it, so together they form a chain: the history of your project. A collection of files plus this history is called a repository, or “repo”.

The Three Areas

This is the most important idea in the whole course. Every change you make moves through three areas before it becomes part of history:

Working directory: the files you see and edit in your project folder
↓
Staging area: the changes you have chosen to include in the next commit (git add)
↓
Repository: the permanent history of commits stored in the hidden .git folder (git commit)

Why have a staging area at all? Because you rarely want to save everything at once. Suppose you fixed a bug and also started an unrelated redesign. The staging area lets you commit just the bug fix, with a clear message, and keep the half-finished redesign out of it. Good commits contain one logical change each.

Mini Challenge · Put It in Order

Put these steps in the order a change travels through Git.

  1. Stage the change with git add
  2. Save a snapshot with git commit
  3. The commit becomes part of the project history
  4. Edit a file in your project folder

Where Git Is Used

  • Software teams of every size — from solo freelancers to companies with thousands of engineers.
  • Open-source projects such as Linux, Python, React and VS Code, all developed in public Git repositories.
  • DevOps and cloud engineering, where infrastructure, configuration and deployment pipelines are stored in Git (often called “GitOps”).
  • Data science and machine learning, to version notebooks, scripts and experiment code.
  • Writers and technical teams, who keep documentation and even books in Git.

Common Mistakes

Avoid These Misunderstandings
  • Thinking Git and GitHub are the same — Git is the tool, GitHub is one place to host repositories.
  • Thinking Git saves automatically — nothing is recorded until you commit.
  • Treating Git as a backup of your whole computer — it tracks the project folders you choose, not everything.
  • Being afraid to commit often — small, frequent commits are easier to understand and easier to undo.

Frequently Asked Questions

Yes. Git is free and open-source software, released under the GPL licence. GitHub also has a free plan with unlimited public and private repositories.

No. Git works with any kind of file. This course uses a small HTML website as its example project, but you only need to be comfortable creating and editing files.

The everyday commands — status, add, commit, push and pull — take an afternoon to learn. The ideas behind branching and merging take a little longer, which is why this course builds them up step by step with real output.

Learn the commands first. They work everywhere, every tutorial and error message uses them, and once you understand them, graphical tools become easy to read.

Key Takeaways

  • Version control records the history of a project so you can compare, undo and collaborate safely.
  • Git is a free, distributed version control system created by Linus Torvalds in 2005.
  • GitHub is a website that hosts Git repositories and adds collaboration features.
  • Git stores a project as a chain of snapshots called commits, each with a unique ID.
  • Changes move from the working directory to the staging area (git add) to the repository (git commit).

Summary

You now know what version control is, why Git became the standard, how it differs from GitHub, and the three areas every change passes through. In the next lesson you will install Git, introduce yourself to it, and set up a few defaults that save headaches later.

Next Lesson →

Installing and Configuring Git