ProgramGuru

Open a pull request that is easy to review

Open a pull request that is easy to review

A pushed branch becomes collaborative when you propose how it should enter another branch and give reviewers the context needed to evaluate it.

What you’ll learn

  • Explain base and compare branches.
  • Open a PR from a pushed branch.
  • Write review-friendly PR context.

A pull request wraps collaboration around Git commits

  1. Feature branch

    Contains proposed commits.

    head
  2. Pull request

    Shows diff, discussion and checks.

    review space
  3. Base branch

    Receives the change after approval/merge.

    main
main

A pull request is a proposal plus discussion and checks

A pull request compares a head/compare branch containing proposed changes with a base branch that would receive them. The PR updates as new commits are pushed to the compare branch.

A strong description explains the problem, approach, important trade-offs, testing performed and any screenshots or migration notes needed. Keep the scope focused enough to review.

Publish a branch and open a pull request

Run this in a disposable practice repository unless the lesson explicitly says otherwise.

git switch -c feature/search
# edit, test, commit
git push -u origin feature/search

# Optional with GitHub CLI:
gh pr create --base main --head feature/search --fill

Pushing the branch and opening the pull request are separate operations. The PR does not replace the Git commits; it organizes review around them.

Practice: Pull requests

Your task: Write a PR description for a two-file change using four headings: Why, What changed, How tested, Reviewer notes.

Common pitfall to avoid

Do not bundle unrelated refactors, formatting and features into one huge PR when they can be separated. Review quality falls when the reviewer cannot isolate intent.

Check your understanding

What is the base branch in a pull request?
Choose one answer. You can try again.

Answer and explanation

The branch intended to receive the proposed changes.

Correct.

Pull requests: what to remember

Open a pull request that is easy to review is complete when you can explain the state being changed before you run the command, not merely repeat the syntax.

Read further: official supporting documentation.

Reaching the recap and completing the quizzes are separate milestones.

    Next lesson: Review code and choose a merge method →