5

Infrastructure

GitHub: Repos, Commits & PRs

Save your code, track changes, and collaborate — a complete beginner's walkthrough

GitHub is where developers store and manage their code. It's like Google Drive, but specifically designed for code — it tracks every change you make, lets you undo mistakes, and makes it easy to collaborate with others (or with AI tools like Claude Code). If you're writing code of any kind, GitHub is essential.

Why do I need this?

  • Version history — every change you make is saved. You can go back to any previous version at any time.
  • Backup — your code lives in the cloud, not just on your computer. Laptop dies? Your code is safe.
  • Deployment — services like Vercel (Guide #7) deploy directly from GitHub. Push your code → your site updates.
  • AI tools love it — Claude Code and other AI coding tools work best when your project is a Git repository.

Key vocabulary

Git and GitHub have their own language. Here are the words you'll see constantly:

  • Git — the version control software that runs on your computer. It tracks changes to files.
  • GitHub — a website that stores your Git projects online and adds collaboration features.
  • Repository (repo) — a project folder tracked by Git. Every project gets its own repo.
  • Commit — a saved snapshot of your project at a specific moment. Like a save point in a video game.
  • Push — upload your local commits to GitHub.
  • Pull — download the latest changes from GitHub to your computer.
  • Branch — a parallel version of your project for testing changes without affecting the main version.
  • Pull Request (PR) — a proposal to merge changes from one branch into another. This is where code review happens.

Step 1: Install Git

  • Mac: Open Terminal (Cmd + Space, type "Terminal"). Type git --version. If Git isn't installed, your Mac will offer to install it. Click "Install."
  • Windows: Go to git-scm.com and download the installer. Run it with the default settings. This also installs "Git Bash," a terminal app you can use for Git commands.
  • Verify it works: open your terminal and type git --version — you should see a version number.
Claude Code can do this for you
You can ask Claude Code to handle all of the Git commands for you. Say "commit my changes" or "create a new branch called feature-login" — Claude runs the right commands automatically.

Step 2: Create a GitHub account

  • Go to github.com and sign up (free)
  • Pick a username — this becomes part of your profile URL (github.com/yourusername)

Step 3: Configure Git on your computer

Tell Git who you are (this info appears on your commits):

  • Open your terminal
  • Type: git config --global user.name "Your Name"
  • Type: git config --global user.email "you@email.com"
  • Use the same email you signed up to GitHub with

Step 4: Create your first repo and push code

  • On GitHub, click the + button (top-right) → "New repository"
  • Name it something like my-first-project
  • Check "Add a README file" and click "Create repository"
  • Click the green "Code" button and copy the HTTPS URL
  • In your terminal: git clone [paste the URL] — this downloads the repo to your computer
  • cd my-first-project — enter the folder
  • Make a change — edit README.md or create a new file
  • git add . — stage all changes
  • git commit -m "my first commit" — save the snapshot
  • git push — upload to GitHub
  • Refresh the GitHub page — your changes are there!
If GitHub asks for authentication when you push, it will walk you through setting up a token or SSH key. Follow the prompts — this is a one-time setup.
Claude Code can do this for you
In Claude Code, you can skip all of these commands. Just say "push my changes to GitHub" or "create a new repo for this project" and Claude handles the rest, including writing a commit message for you.

The .gitignore file

Some files should never be uploaded to GitHub — things like passwords, API keys, and large auto-generated folders. A .gitignore file tells Git what to skip.

  • Create a file called .gitignore in your project's root folder
  • Add one entry per line for things Git should ignore:
  • node_modules/ — the giant folder of installed packages (can be re-downloaded)
  • .env — environment variables (often contain secrets)
  • .DS_Store — Mac system files (nobody needs these)
Never push API keys, passwords, or secret tokens to GitHub. Even in private repos, it's a bad habit. Use a .env file locally and add it to .gitignore.
Try this now

Follow Steps 1–4 above end to end. Create a repo, clone it, add a file, commit, and push. It takes about 10 minutes and you'll have version-controlled code on GitHub. From here, you can deploy it on Vercel (Guide #7) or start using Claude Code with it (Guide #3).