Courses Curriculum Cities Blog Enroll Now
Git & GitHub for AI Projects · Day 3 of 5 ~35 minutes

Day 3: Collaboration: Pull Requests and Code Review

Open a real Pull Request, review code, and use GitHub's collaboration tools the way professional teams do.

1
Day 1
2
Day 2
3
Day 3
4
Day 4
5
Day 5
What You'll Build

A complete Pull Request workflow: open a PR with a description, review the diff, add comments, approve it, and merge — with GitHub Actions running a basic check automatically.

1
Section 1 · 8 min

What Is a Pull Request?

A Pull Request (PR) asks others to review and merge your branch. Even on solo projects, PRs create a paper trail of every change and why it was made. Many companies require them even for one-person changes.

A good PR has: a clear title, a description of what changed and why, a testing checklist, and links to related issues.

markdownPR description template
## What this PR does
Adds a /summarize endpoint to the FastAPI backend that calls Claude.

## Why
Users need to summarize long documents without copy-pasting to the Claude UI.

## Testing
- [ ] Unit test for summarize() passes
- [ ] Manual test with 1000-word document
- [ ] Error case: empty string returns 400

## Screenshots
[paste curl output here]
2
Section 2 · 10 min

Open a Pull Request via GitHub CLI

The GitHub CLI (gh) lets you open PRs from the terminal without switching to the browser. Install it with brew install gh, then authenticate with gh auth login.

bashterminal
# Install GitHub CLI
brew install gh
gh auth login

# Create and push your branch
git checkout -b feature/add-summarize-endpoint
# ... make changes and commit ...
git push -u origin feature/add-summarize-endpoint

# Open a PR
gh pr create   --title "Add /summarize endpoint"   --body "Adds Claude-powered document summarization. Tests passing."   --base main

# View the PR status
gh pr status

# List all PRs
gh pr list
3
Section 3 · 9 min

GitHub Actions: Automate Your Checks

GitHub Actions runs code automatically on events like pull requests. Set up a simple CI check that runs your tests on every PR — you'll catch bugs before merging.

yaml.github/workflows/test.yml
name: Run Tests

on:
  pull_request:
    branches: [main]
  push:
    branches: [main]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: "3.11"
      - name: Install deps
        run: pip install -r requirements.txt
      - name: Run tests
        run: pytest tests/ -v
        env:
          ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}

Add your API key as a secret: GitHub repo Settings > Secrets and variables > Actions > New repository secret. Name it ANTHROPIC_API_KEY.

4
Section 4 · 8 min

Merge and Clean Up

After approval and passing checks, merge the PR. Then clean up the branch both locally and on GitHub.

bashterminal
# Merge the PR via CLI
gh pr merge --squash --delete-branch

# Update local main
git checkout main
git pull

# Delete local branch (already deleted on GitHub)
git branch -d feature/add-summarize-endpoint

# See your clean commit history
git log --oneline
# d7f8a9b Add /summarize endpoint
# a1b2c3d Initial project setup

--squash combines all your branch commits into one clean commit on main. Keeps the history readable. Alternative: --merge for a merge commit or --rebase for linear history.

What You Learned Today

  • Opened a Pull Request with a clear description and checklist
  • Set up GitHub Actions to run tests automatically on every PR
  • Merged a PR cleanly using squash merge
  • Cleaned up local and remote branches after merging
Your Challenge

Go Further on Your Own

  • Add a linting step to your GitHub Actions workflow using flake8 or ruff
  • Write your first pytest test for the summarize() function and watch it pass in CI
  • Protect your main branch on GitHub: require PR reviews before merging
Day 3 Complete

Nice work. Keep going.

Day 4 is ready when you are.

Continue to Day 4
Course Progress
60%

Want live instruction and hands-on projects? Join the AI bootcamp — 3 days, 5 cities.

Finished this lesson?