Pull Requests, Issues & Team Collaboration
Lesson opener
In one line: Pull request (PR) workflow - industry standard in 2026.
Why it matters: This shows up at work when you need to pull request (PR) workflow - industry standard in 2026.
Before this lesson: GitHub essentials
Before you start
| Resource | Link |
|---|---|
| Previous | GitHub essentials |
| Next | CI/CD & deployment |
| Time | ~55 minutes |
What you will learn
- Pull request (PR) workflow — industry standard in 2026
- Code review basics
- GitHub Issues for tasks and bugs
- Branch protection — why you can't push straight to
mainon real teams
Section 1 — Why pull requests exist
Plain English: A PR says "Please merge my branch into main — here's what changed and why." It enables:
- Code review before merge
- Automated tests (CI)
- Discussion on specific lines
- Audit trail for compliance
Section 2 — Open your first PR
git switch -c feature/add-license
echo "MIT License" > LICENSE
git add LICENSE
git commit -m "Add MIT license file"
git push -u origin feature/add-licenseOn GitHub: Compare & pull request → fill template:
## Summary
- Adds MIT LICENSE
## Test plan
- [ ] File renders on repo rootClick Create pull request → Merge pull request → delete branch.
Locally:
git switch main
git pull origin main
git branch -d feature/add-licenseSection 3 — Code review etiquette
As author:
- Keep PRs small (< 400 lines when possible)
- Describe why, not just what
- Respond to comments — don't take review personally
As reviewer:
- Ask questions; suggest alternatives
- Approve when ready — don't block on style nitpicks
Section 4 — Issues — track work
Create issue: Bug: chart shows wrong Q3 total
Link in commit:
git commit -m "Fix Q3 aggregation — closes #12"Keywords: fixes #12, closes #12 auto-close issue on merge (if configured).
Section 5 — Branch protection (production repos)
Repo Settings → Branches → Add rule on main:
- Require pull request before merging
- Require status checks (CI green)
- No force-push
This is why git push origin main fails on company repos — by design.
Section 6 — gh CLI (2026 power user)
Install: https://cli.github.com
gh auth login
gh repo create my-project --public --source=. --push
gh pr create --title "Add license" --body "Summary here"
gh pr list
gh pr merge 1 --squashSame workflows from terminal — used in CI and with Cursor.
Practice
- Open a PR adding a
CONTRIBUTING.mdwith three bullet rules - Self-review: add one comment on your own PR
- Merge and delete the branch
Checklist
- [ ] Opened and merged at least one PR
- [ ] Created an Issue linked to a commit
- [ ] Understand branch protection purpose
Teacher walkthrough: PR as a conversation
All figures illustrative.
Step 1 — Branch + push with a clear name.
Step 2 — Open PR with why, test plan, screenshots if UI.
Step 3 — Review checklist. Correctness, secrets, scope creep.
Step 4 — Merge policy. Squash/merge/rebase per team; delete branch.
Failure example: PR titled "fixes"
Symptom: Reviewers stall; bugs ship; blame unclear.
Diagnosis: No context, no test plan, many unrelated files.
Correction: Small PRs; describe decision; link issue; self-review diff first.
Validation: Reviewer can state the risk in one sentence from the PR body.
Guided practice
List three items you self-check before requesting review.
Complete solution: Diff is only intended files; no secrets; described test plan / how you verified.
Independent practice
Acceptance criteria:
- PR body with why + test plan (even on a personal repo).
- At least one review comment addressed or self-review notes.
- Merge completed without conflict markers.
- Branch cleanup done or explained.
Common mistakes
- Mixing refactors with feature changes.
- Approving without reading diff.
- Merging failing checks "to move on".
What's next
CI/CD & deployment — GitHub Actions, Pages, and shipping from Git.