Skip to main content
Before you write a single Git command, it helps to understand the problem Git is solving. Version control isn’t just a developer habit — it’s the answer to a frustrating experience that every programmer has had at least once.

The problem Git solves

Imagine you’re working on a Python project. Without Git, your project folder probably ends up looking like this:
Git solves this entire mess by tracking your changes properly, so you only ever need one file.

How Git works

Think of Git as taking snapshots of your code over time:
  1. You write code — Make changes to your files as normal
  2. You save a snapshot — This is called a “commit” in Git
  3. Git remembers everything — Every snapshot, who made it, when, and why
Here’s a real example of what this means in practice:

Key concepts you need to know

These six terms cover everything you’ll use on a daily basis: Repository (repo) — A project tracked by Git. Your python-for-ai folder can become a repository. Staging — Choosing which changes to include in your next snapshot. Like selecting items to put in a box before shipping. Commit — A saved snapshot of your code. Like saving in a video game — you can always go back to any save point. Push — Upload your commits to GitHub. This backs up your code online. Pull — Download changes from GitHub. How you get updates when collaborating. Clone — Copy an entire project from GitHub to your computer. This is how you download AI tools and examples.

First: Install Git

Check whether Git is already installed on your machine:
If you see a version number, you’re ready to go. If not, install Git using the instructions for your operating system:
  1. Download the installer from git-scm.com/download/win
  2. Run the installer
  3. Keep all default settings — the defaults are fine
  4. Restart VS Code after installation completes

The simplest Git workflow

Once Git is installed, this is the core workflow you’ll repeat hundreds of times:
These are terminal commands, not Python code. Run them in VS Code’s integrated terminal (open it with Ctrl+`).
That’s it. Three commands and your code is saved and backed up. You can run each command one at a time, or copy and paste all three lines at once — the terminal runs them in sequence.
If you see fatal: not a git repository, you need to run git init first. You only need to do this once per project, in the project’s root folder.

Common questions

No! VS Code has buttons for all Git operations. You’ll learn both approaches in this section, but you can stick to clicking if you prefer. The terminal commands are shown so you understand what’s happening underneath.
Git is very forgiving. Every commit is saved permanently, so you can always go back to a previous state. It’s actually harder to lose work with Git than without it.
No. Git is the tool that runs on your computer and tracks changes. GitHub is a website that stores Git repositories online. You can use Git without GitHub, but GitHub makes sharing and backing up your work much easier.

What’s next?

Now that you understand how Git works, create your GitHub account so you have somewhere to store your code online.

GitHub Setup

Create your account and connect Git to GitHub in 5 minutes