The problem Git solves
Imagine you’re working on a Python project. Without Git, your project folder probably ends up looking like this:How Git works
Think of Git as taking snapshots of your code over time:- You write code — Make changes to your files as normal
- You save a snapshot — This is called a “commit” in Git
- Git remembers everything — Every snapshot, who made it, when, and why
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. Yourpython-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:- Windows
- macOS
- Linux
- Download the installer from git-scm.com/download/win
- Run the installer
- Keep all default settings — the defaults are fine
- 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+`).Common questions
Do I need to use the terminal?
Do I need to use the terminal?
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.
What if I mess up?
What if I mess up?
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.
Is Git the same as GitHub?
Is Git the same as GitHub?
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