Chapter 07Lesson 03~125 minutes

Pull Requests, Drafts, Linked Issues, Change Sets, and Collaboration Patterns: Configuration, Design Choices, and Tradeoffs

Choose deliberately between draft-first and ready-first collaboration, large and small change sets, linked issue lifecycle policies, same-repository and fork pull requests, and dependent-change patterns without confusing convenience with governance.

Review scopeFork PRIssue lifecycleTradeoffs

Learning objectives

  • Choose draft-first versus ready-first pull-request timing from review cost, uncertainty, and team expectations.
  • Design change-set size around reviewability, rollback, dependency boundaries, and validation cost rather than arbitrary line counts.
  • Choose manual Issue linking versus auto-closing keywords based on lifecycle ownership and branch strategy.
  • Select fork PR versus same-repository PR based on trust, permissions, automation boundaries, and contributor topology.
  • Explain stacked/dependent PR tradeoffs and the effect of changing bases as earlier changes merge.
  • Label plan, repository-visibility, GitHub.com/Enterprise, and policy-dependent behavior without making paid features mandatory.
Availability: The required design exercises use a public repository and GitHub Free. Draft PR availability is therefore on the free path. Organization/team review policies, private-fork workflow controls, required reviewers, and enterprise governance are optional design cases.

1. Configuration begins with an ownership question

Every pull-request convention assigns ownership: who decides when review should start, who owns Issue closure, who may update the head branch, who interprets checks, and who may merge. A good policy makes these decisions explicit before adding automation. A bad policy replaces them with labels and rituals whose meaning changes from team to team.

2. Draft early versus open only when ready

Choice Prefer when Tradeoff
Draft early You want visibility, early design feedback, or CI on an evolving branch Reviewers can receive noise if “draft” does not reliably mean “not ready for final review”
Open ready Scope is already understood and review should begin immediately Less early visibility; architectural mistakes may be discovered later
Draft → ready gate Team wants one PR number from early work through formal handoff Requires authors to keep title/body and readiness honest

Draft state is best used as a contract: “this change is visible, but do not treat it as final review work.” It is not a substitute for a clear PR description, tests, or explicit blockers.

3. One large PR versus smaller reviewable changes

Review cost is driven by conceptual surface area, not only line count. A 30-line authentication change can be riskier than a 500-line generated documentation update. Prefer boundaries that let a reviewer answer: what behavior changes, what evidence validates it, what depends on it, and how would we revert it?

Signal Smaller PRs help when… A single PR may be better when…
Dependency Changes can land independently Splitting creates impossible intermediate states
Review expertise Different areas need different reviewers One invariant spans all files and must be reviewed together
Rollback You want independent rollback units Partial rollback would violate compatibility
Automation Checks can validate each unit The useful test only makes sense on the complete change
History Each PR has a coherent narrative Splitting would create bookkeeping-only PRs

4. Auto-closing Issues versus manual lifecycle transitions

Use a closing keyword when “merging this PR into the default branch means this Issue is resolved” is genuinely true. Use a plain cross-reference or manual link when the PR is only one part of the work, when deployment is required before closure, or when a release branch is the target. Current GitHub behavior specifically ties closing-keyword interpretation to the default-branch target.

Design rule: if Issue closure represents “available in production,” do not let a source merge automatically close it unless your operating model intentionally equates those states.

5. Same-repository PR versus fork PR

Dimension Same-repository branch Fork PR
Typical trust Contributor has push permission to repository branch Contributor controls a separate repository
Head ownership Base repository owns head branch Fork owner owns head branch
Secrets/Actions Normal repository event policy applies Fork PRs are a stronger untrusted-code boundary; approvals/limited tokens may apply
Maintainer edits Usually straightforward when permissions allow Explicit maintainer-edit setting; workflow-secret implications require care
Open-source fit Good for trusted maintainers Natural for external contributors without upstream write access
Enterprise fit Common inside one governed org/repo May be constrained by private/internal fork and enterprise policy

Do not choose forks merely because “open source uses forks.” Choose them when the permission/trust boundary is useful. Likewise, do not put external contributors on writable branches merely to avoid fork complexity.

6. Stacked/dependent PRs: smaller reviews with explicit ordering cost

Suppose PR B requires code introduced by PR A. If B targets A’s branch, reviewers can inspect only B’s incremental work. After A merges, B’s base may need to move to the main branch. This can make review dramatically easier—but every dependent PR now has an ordering dependency, and changing a base can make commits disappear from the timeline or make review comments outdated.

  1. Declare the dependency in the PR body and link the parent PR.
  2. Do not merge a child before its prerequisite unless the repository model intentionally supports it.
  3. Before changing a base, capture current base/head OIDs, commit list, and unresolved review conversations.
  4. After retargeting, re-inspect the commit range and Files changed; do not assume the UI retained the same review context.

7. Checks are evidence, not a universal policy

Checks can come from GitHub Actions or external systems. Repository rules may require some checks before merge, but the existence and names of checks are repository-specific. A course lab must therefore not hard-code “CI passed” as a universal property. Later Actions and ruleset chapters will define those mechanisms in depth.

Fork PRs deserve extra caution. Public-fork workflows may require maintainer approval, and private-fork workflow settings can control token/secrets behavior. The safe default is to treat fork-provided code and workflow edits as untrusted until reviewed.

8. Plan and deployment boundaries

  • GitHub.com public repositories: mandatory course path; draft PRs are available on GitHub Free.
  • Private repositories: draft/review and protection availability can vary by plan; verify current docs before codifying policy.
  • Organization/team reviewers: team-based review and multiple-reviewer capabilities can depend on organization context/plan.
  • GitHub Enterprise Server: use the installed GHES version documentation rather than assuming GitHub.com timing or UI.
  • External CI/deployment: check/deploy state is owned by those integrations, even when surfaced inside the PR.

9. Worked decision: choose a PR operating model for three teams

Scenario Recommended approach Rationale
Small internal service, trusted 5-person team Same-repo topic branches; draft early for cross-cutting changes; small coherent PRs Low permission friction, high visibility, simple CI context
Public library with unknown contributors Fork PRs; maintainer approval for risky workflow runs; clear ready/review criteria Preserves external-contributor trust boundary
Large migration with dependent schema/API changes Stacked PRs with explicit parent/child links and base-change checklist Keeps review units small while acknowledging ordering
Incident hotfix Ready-first small PR; explicit Issue/reference; avoid unnecessary stack Minimize coordination latency while preserving review evidence

The decision is not purely security-driven. Maintainability, reviewer throughput, rollback, compatibility, governance, and CI cost all matter. A pattern that is excellent for a public library can be unnecessary overhead for a two-person internal tool.

10. Common policy anti-patterns

  • Draft forever: draft becomes a storage state rather than a meaningful readiness signal.
  • Every PR closes an Issue: Issue lifecycle becomes coupled to source merge even when release/deployment is later.
  • One PR per commit: confuses Git history granularity with review/change-control granularity.
  • Forks for everyone: adds trust/remote complexity even for fully trusted maintainers without a governance reason.
  • Green = safe: assumes automated checks cover human, operational, and deployment risk.

11. Lesson summary

Pull-request design is about choosing collaboration boundaries: when work becomes reviewable, how large a change set should be, whether merge owns Issue closure, where the head branch lives, and how dependencies are represented. The correct answer depends on trust, repository policy, release semantics, and reviewer capacity—not fashion.

Knowledge check

When is Closes #42 a poor choice even if the PR fixes code?

What is the main governance reason to choose a fork PR?

Why can stacked PRs improve review but increase operations cost?

Should a team define a maximum PR line count as its only reviewability rule?

What does “draft” ideally communicate?

Next lesson

Diagnose misleading pull requests from evidence

Lesson 04 engineers wrong-base and unrelated-commit failures, then separates history repair from metadata repair and from deployment/check interpretation.

Authoritative references

 Changing the stage of a pull request
 Linking a pull request to an issue
 Changing a pull request base branch
 Requesting a pull request review
 Allowing maintainer edits to a fork PR
 Approving workflow runs from forks
 Managing Actions settings for a repository
 Managing protected branches
 Pull request merges

Keep the academy open

Support free, practical DevOps education.

Every lesson is designed to remain readable in a browser, downloadable from GitHub, and usable without a paid learning platform. Contributions help expand and maintain the curriculum.

Ethereum / ERC-20
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0 Send only Ethereum/ERC-20 compatible assets to this address.