Stop 01 · Programming & CS FoundationsTopics · 9/12

Git & GitHub Basics

Part of the AI Engineer Roadmap

In short

You tweak a training script, the accuracy drops, and you can't remember what you changed. Git saves a snapshot every time you commit, so you can go back. GitHub keeps those snapshots online.

Version control for code and notebooks — essential once you're tracking model experiments, collaborating, or open-sourcing a project.

The purple blob takes instant photos of a desk and pins them in order on a string.

Think of it like this

Photos of your room after each clean-up

Each time you tidy your hostel room, you click a photo and pin it on a string in order. If the room gets messy, you look at yesterday's photo and put things back. Commits are those photos. GitHub is a shared album your friends can see too.

Watch it happen

From an edit to GitHub

Edit files
Staging
Commit
GitHub

1/4You change train.py. Git notices the file is modified but hasn't saved anything yet.

The big ideas

What you need to know

A commit is a snapshot

It records what every tracked file looked like, who made it and why. Small commits with clear messages are easy to undo.

Branches let you experiment

git switch -c new-feature makes a side line of work. If it fails, main is untouched.

.gitignore keeps junk out

List .venv, data files, model checkpoints and .env secrets so they never get committed by accident.

Git vs GitHub

Git is the tool on your laptop. GitHub is a website that hosts Git repositories and adds pull requests and issues.

See it in code

Walk through the code

bash
1git init -b main2echo ".venv/" >> .gitignore3echo "data/" >> .gitignore4 5git add .6git commit -m "Add data cleaning script"7 8git switch -c try-new-features9# ...edit, add, commit...10git switch main11 12git remote add origin https://github.com/<you>/my-ai-project.git13git push -u origin main

1/4Start a repo on a branch called main and ignore the env and data folders.

This sets up a repo, keeps the environment and data out, makes a first commit, tries a branch, and pushes main to GitHub.

Save yourself the pain

Common mistakes

Oops

Committing a 2 GB dataset or a .env file with API keys.

Do this instead

Add them to .gitignore before your first commit. If a key gets pushed, revoke it, because history keeps it.

Oops

One giant commit at the end of the week called 'changes'.

Do this instead

Commit each small working step with a message that says what changed and why.

Your mission

Put a project on GitHub

~30 min

Quick check

You edited a file and ran git commit, but your change isn't in the commit. What's the likely reason?

Go deeper

  1. 1Practice the core loop: clone, branch, commit, push, pull request.
  2. 2Learn a `.gitignore` pattern for ML projects (data files, model checkpoints, `.env`).
  3. 3Push a small project to GitHub and write a clear README.

More topics at this stop

Stuck on this topic? Ask an Insider

Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.

Download
InsideEdge