×

Branches and pull requests

⏱ 35 min8 steps

is like a photo album with a picture of your project after every change. If something breaks, you go back to the last good picture. It's also the right backup for a project, the one I mentioned in the folders lesson instead of .

Next, you'll put my-idea on GitHub and make one change the careful way. If signing in to GitHub from stalls you, you're in good company. The fixes are under that step.

GitHub A website that keeps a copy of your git project, with every version saved. Your backup, and where changes get reviewed. All wordsiCloud Apple's online storage. It can copy folders from your Mac to the internet and keep them in sync. All wordsTerminal An app on your Mac where you type instructions instead of clicking on things. Claude Code works inside it. All words
×

Steps

Step 1 of 80 done · about 35 min left

Steps for
  1. Step 1 of 8, not done yet
  2. Step 2 of 8, not done yet
  3. Step 3 of 8, not done yet
  4. Step 4 of 8, not done yet
  5. Step 5 of 8, not done yet
  6. Step 6 of 8, not done yet
  7. Step 7 of 8, not done yet
  8. Step 8 of 8, not done yet
  1. Make a GitHub account and turn on two-step sign-in

    1. Go to github.com in your and sign up. Use the email you use for your projects.
    2. Turn on , the way you did in Security basics. In GitHub, click your profile picture in the top-right corner, then Settings, then Password and authentication, and click Enable two-factor authentication.
    browser The app you use to visit websites, like Safari or Chrome. All wordstwo-step sign-in Signing in with your password plus a second thing, like a code on your phone, so a stolen password isn't enough. All words
    That's not what I see
    The username I want is taken.
    Add something short to it, like your initials or a word you like. People will see it, so pick one you'd be happy to put on a business card.
  2. Get git and GitHub's tool for Terminal

    Claude needs two tools to put your project on GitHub: , which saves the versions, and gh, GitHub's own tool for Terminal. Your Mac hasPC may have git, or offers to already. If not, you it. yourself. You install gh yourself, like any MacWindows app, because in Claude won't download and install programs for you.

    1. Open Terminal (Cmd+SpaceWindows key, type Terminal, press Enter).

      On Windows, get both tools with winget, which comes with Windows. Type the first line below and press Enter. If it asks you to agree to the terms, type Y and press Enter. If Windows asks whether to let the app make changes to your device, click Yes. When it says Successfully installed, do the same with the second line. Then close the window with Ctrl+Shift+W and open a new one. Do item 2, skip items 3 to 5, which are for Macs, and finish with item 6.

      winget install --id Git.Git -e --source winget
      
      winget install --id GitHub.cli -e --source winget
      
    2. Check for git. Type this and press Enter:

      git --version
      
    3. In your browser, go to github.com/cli/cli/releases/latest. Scroll down to Assets and click the ending in macOS_universal.pkg.

    4. Open the downloaded file. Your Mac will say it can't check it for malware, because GitHub doesn't sign this installer. Click Done. Only do the next part for a file you got from a page you trust, like this one from GitHub.

    5. Open System Settings, click Privacy & Security, scroll down, click Open Anyway next to the installer's name, and enter your Mac's password. Click through the installer.

    6. Back in Terminal, check it worked. Type this and press Enter:

      gh --version
      
    git A tool that saves a snapshot of your project every time you ask, so you can always go back. All wordsinstall Put a new program on your computer so you can use it. All wordsauto mode Claude works without asking, and a separate safety checker blocks anything risky. All wordsfile One document on your computer, like a letter or a photo. Files live inside folders. All words

    You should see:

    Lines like git version 2.39.3 (Apple Git-146)2.56.0.windows.1 and gh version 2.83.1 (2025-11-13). Your numbers may be different.

    That's not what I see
    A pop-up says: The "git" command requires the command line developer tools.
    That's your Mac offering to install the tools git needs. Click Install, agree, and wait for it to finish. It can take a while. Then type git --version and press Enter again.
    It says "zsh: command not found: gh".
    The installer may not have finished, or your Mac blocked it. Open the file you downloaded and run the installer again. Then close the window with Cmd+W, open a new one and try again.
    It says "The term 'gh' is not recognized" or "The term 'git' is not recognized".
    That's on Windows, and this window doesn't know about the new tool yet. Close it with Ctrl+Shift+W, open a new one and try again. Still there? Type that tool's winget line again, press Enter and wait for it to say Successfully installed.
    It says "The term 'winget' is not recognized".
    Your copy of Windows needs an update before it has winget. Open the Microsoft Store, search for App Installer and click Update. Or get the installers from the websites instead: Git for Windows from git-scm.com, and the file ending in windows_amd64.msi from github.com/cli/cli/releases/latest.
  3. Sign in to GitHub from Terminal

    This , from GitHub, signs Terminal in to your GitHub through your browser. You do it yourself, before you start .

    1. Type this and press Enter:

      gh auth login
      
    2. It asks a few questions. Press Enter at each one to take the first answer: GitHub.com, HTTPS, Yes, then Login with a web browser.

    3. When it shows a code, press Enter. GitHub opens in your browser.

    4. Type the code, click Continue, then click Authorize github.

    5. Go back to Terminal.

    command An instruction you type into Terminal. Your Mac does it when you press Enter. All wordsaccount A sign-in with a company, like a domain, email or hosting. Whoever owns the account controls what's in it. All wordsClaude Code Claude, working inside Terminal. It can make files and run things on your Mac, with a safety checker watching what it does. All words

    You should see:

    ✓ Logged in as and your GitHub username.

    That's not what I see
    It shows a code and says to press Enter to open github.com.
    That's normal. Press Enter. On the GitHub page that opens, type the code, click Continue, then click Authorize github. Then go back to Terminal.
  4. Start Claude Code in your my-idea folder

    1. Go to your my-idea . Type this and press Enter:

      cd ~/Backyard/my-idea
      
      cd ~\Backyard\my-idea
      
    2. Check the says my-idea.

    3. Start Claude Code. Type this and press Enter:

      claude
      
    folder A place on your computer that holds files and other folders, like a drawer in a filing cabinet. All wordsprompt line The line in Terminal that ends with a % sign. The word right before the % is the folder you're in. All words

    You should see:

    Claude Code's name and version at the top, a line starting with ❯ where you type, and ⏵⏵ auto mode on in the bar at the bottom.

    That's not what I see
    It says "cd: no such file or directoryCannot find path … because it does not exist".
    The my-idea folder isn't there. It comes from Check the idea first and The three files, so do those first, then come back.
    It says "zsh: command not found: claudeThe term 'claude' is not recognized".
    This Terminal window doesn't know about Claude Code. Close the window with Cmd+WCtrl+Shift+W, open a new one and try again. If it still says that, go back to Install Claude Code and sign in.
  5. Save your project's first version and put it on GitHub

    This asks Claude to set up git in your my-idea folder, save the first version, and put it on GitHub as a private .

    1. Copy the prompt below.
    Turn this folder into a git project and save everything in it as the first version. Name the main branch main. Then use gh to put it on my GitHub account as a private repository. I've already signed in with gh auth login. Walk me through anything I need to do myself, one step at a time, and wait for me to say done. Explain each step in plain words as you go. Don't make anything public.
    1. Paste it into Claude Code with Cmd+VCtrl+V and press Enter.
    2. Follow Claude's directions one at a time, and type done when it asks.

    Claude sets up git, saves the first snapshot (called a ) and puts it on GitHub.

    prompt What you type to Claude. A good one says what you want, how to work and what never to do. All wordsrepository One project on GitHub, with all its files and every saved version. People say repo for short. All wordscommit A saved snapshot of your project, with a short note saying what changed. Git keeps every one, so you can go back to any of them. All words

    You should see:

    Claude saves the first version, puts it on GitHub and gives you a link to your private repository.

    That's not what I see
    I'm not sure whether it's private.
    Ask Claude: Is my repository private? Show me how you checked. On GitHub, a private one has a small Private label next to its name.
    Claude says gh isn't signed in to GitHub.
    Type and press Enter. Do Sign in to GitHub from Terminal again, then type claude -c, press Enter and tell Claude: Done, I'm signed in./exit Typed in Claude Code, it ends the conversation and takes you back to Terminal. All words
  6. Make a change on a branch and open a pull request

    Branches and pull requests add one more habit: never change the live version directly. You propose a change and look at it before it goes in. A person decides, and that person is you.

    A is a copy of the project where you try a change without touching the main version. A asks to bring that change in.

    This prompt asks Claude to make a branch, add one sentence to on it, and open a pull request without merging it. Your sentence goes at the end.

    1. Copy the prompt below.
    Make a new branch called first-change. On it, add one line to the top of README.md that says what this project is, in my own words. Save the change, send it to GitHub, and open a pull request. Don't merge it. Give me the link to the pull request. Here's my sentence:
    1. Paste it into Claude Code with Cmd+VCtrl+V.
    2. Type a space, then one sentence about your project, like A weekly meal-prep service for nurses who work night shifts.
    3. Press Enter.
    branch A copy of the project where you try a change without touching the main version. All wordspull request A request to bring a branch's change into the main version. You read it first, then merge it or don't. All wordsREADME.md The front door of a project. It says what the project is and how to run it, for you in six months and anyone you hand it to. All words

    You should see:

    Claude makes the branch (a line says Switched to a new branch 'first-change'), adds your line to README.md, sends it to GitHub and gives you a link to the pull request. The link ends in /pull/1.

    That's not what I see
    The link doesn't open.
    Hold CmdCtrl and click it. If that doesn't work, right-click it and chooseon a Mac you'd right-click it and choose **Open **. Or select the link, copy it with Cmd+COn Windows, select the link, copy it with Ctrl+Shift+C and paste it into your browser's address bar.URL The address of a page on the internet, like gethomebydark.com. You type it in the bar at the top of your browser. All words
  7. Read the pull request on GitHub and merge it yourself

    1. Open the link Claude gave you.
    2. Click Files changed. Green lines were added, red lines were removed. Read every one.
    3. If it's right, click Conversation, scroll down and click pull request, then Confirm merge.
    merge Bring a change from a branch into the main version. All words
    That's not what I see
    I don't see a Merge pull request button.
    Scroll to the bottom of the Conversation tab. If GitHub says there's a conflict, don't try to fix it on the website. Go back to Claude Code and ask: The pull request says there's a conflict. What does that mean, and how do we fix it?
    Claude offered to merge it for me.
    Say no for now. Reading the change and merging it yourself is the point. In auto mode, the safety checker blocks Claude from merging a pull request nobody has approved anyway.
  8. Bring the merged change back to your computer

    The change is on GitHub, but the copy on your Macyour PC doesn't have it yet. This message asks Claude to fetch it.

    1. Copy the message below, paste it into Claude Code and press Enter.
    Switch back to main and get the merged change from GitHub.

    That's the whole loop: branch, change, pull request, read, merge. From here on, every change to anything that matters goes this way.

    merged Brought into the main version. Merged doesn't mean working. You still check. All words

    You should see:

    Claude switches back to main and brings in the change you merged. README.md on your Macyour PC now starts with your sentence.

    Switched to branch 'main'
    Fast-forward
     README.md | 1 +
    That's not what I see

    Nobody has reported a snag on this step yet. Getting stuck is normal. Read the step again one line at a time, and compare your screen with the video.

×

Your challenge

For your next three changes to this project, have Claude make each one on a branch and open a pull request. Read every one on GitHub and merge it yourself.

Last checked 2026-10-17

Start