Skip to content
codemaxxing.io

started by Marlow and Angus

Notes06

note 06

Git and GitHub

Git is the notebook on your computer. It saves snapshots of the project so you can see what changed and go back. GitHub is a website that keeps a copy of that notebook. People mix the two up. They are not the same thing.

  1. 01

    Two different things

    Git is a program on your computer. It watches the project folder and stores snapshots, called commits. Those snapshots live in a hidden folder named .git. You do not open that folder. You talk to it with commands.

    GitHub is a website. You put a copy of the notebook there. That is how a parent can see the files, how Vercel can update the live site when you push, and how the project survives if the laptop dies.

    GitLab and Bitbucket do the same job as GitHub. You will hear GitHub. Pick that unless someone already set you up somewhere else.

  2. 02

    Why this matters here

    An agent will change a lot of files, fast. Git is how you see what it did, and how you undo a bad stretch without starting the whole project over.

    A vercel.app link can go up without GitHub. Connecting GitHub is still the usual path: you push, Vercel notices, the live site updates. That is less fragile than uploading from the laptop each time.

    You do not need branches, pull requests, or a team to start. Stay on main — that is the default line of snapshots, and the one that should work. A branch is a parallel copy. A pull request is “please put my branch into main.” Useful with other people. Later.

  3. 03

    The words

    You will see these in the terminal, in Cursor, and in things the agent says. You do not need the rest of the vocabulary yet.

    • Repo

      Short for repository. The project folder that Git is watching. “The repo” just means this project.

    • Commit

      A snapshot with a short note, like “lime button works.” Not the same as saving a file. Saving updates the file. A commit freezes a version you can return to.

    • Push / pull

      Push sends your new commits to GitHub. Pull brings GitHub’s commits onto this computer. Clone is the first download of a repo you do not have yet.

  4. 04

    Cheat sheet

    Run these in the project folder. If git status says “not a git repository,” the folder is not a repo yet — ask the agent to set that up, or run git init, then connect GitHub.

    Look first

    Look first
    Type thisWhat it does
    git statusWhat changed, and whether you have committed it yet. Start here.
    git diffThe actual lines that changed. Read this when the agent did a lot.
    git log --onelineThe recent snapshots, newest first, one line each.

    Save a snapshot

    Save a snapshot
    Type thisWhat it does
    git add .Stage everything that changed, ready to commit. The dot means “this folder.”
    git commit -m "lime button works"Take the snapshot. The words in quotes are the note. Say what changed, not “update” or “fixes.”
    git pushSend new commits to GitHub. Until you push, the internet copy is behind.

    Get or undo

    Get or undo
    Type thisWhat it does
    git pullDownload commits from GitHub that this computer does not have yet.
    git clone https://github.com/you/the-repoFirst-time copy of a repo onto this computer. Then cd into the new folder.
    git restore .Throw away uncommitted edits and go back to the last commit. Only do this if you mean it — those edits are gone.
  5. 05

    A GitHub account

    You need an account on github.com. That means an email, a password, and usually a grown-up — GitHub has age rules, and the email is a family call. Do not invent a second secret account to skip that.

    A repository can be public or private. Public means anyone with the link can read the code. That is fine for a joke site with no real names. Private if there are photos of people, classmates’ names, or you just do not want it findable. Ask before you flip that switch.

    Do not put passwords, API keys, or .env files on GitHub. Those belong on your computer, or in Vercel’s settings, not in the notebook. If the agent commits a secret, tell a grown-up and take the secret down — changing the file later does not erase it from old commits.

    The first time you push, GitHub will ask you to sign in. Once is enough. Git also wants your name and email on this computer (git config). The agent can set that. Use a real email the family controls, not a joke.

  6. 06

    Using it with an agent

    When a chunk works, commit it. “Commit this. Message: lime button works.” Do not wait until Friday and save twenty mixed-up changes as one snapshot. Small commits are how you go back to the last good version.

    If the agent wrecks the page, say “go back to the last commit that worked” instead of starting a new folder. That is the whole point of the notebook.

    Look at git diff before you commit a huge agent pass. You are allowed to say no. You are allowed to commit only the files you like.

    Do not let the agent force-push, rebase, or “clean up history” unless you know what those words mean. They rewrite the notebook. Easy to lose work. Easy to confuse GitHub and Vercel.

    Cursor has a Source Control panel with the same jobs as the commands. GitHub Desktop is a separate app with buttons. Fine if you want them. The agent will still speak in git status and git commit — worth knowing the words.

You do not need all of Git. status, diff, commit, push, and “go back to the last one that worked” will get you through a first project. Branches and pull requests can wait until there is a second person.