Skip to main content

Writing a pull request maintainers want to merge

Updated

Open-source maintainers spend hundreds of hours reviewing code outside their day jobs. A pull request that is easy to review, thoroughly tested, and respectful of their time is far more likely to be merged promptly. Conversely, a massive pull request with no description, failing tests, and unrelated edits often stalls for weeks.

Whether you are submitting your very first open-source fix or building up your profile on a GitHub activity tracker, following this practical checklist ensures your contributions stand out for the right reasons.

1. Keep pull requests small and focused

The single most effective way to speed up a code review is to limit scope. A pull request should do one thing and do it well: fix a specific bug, add an isolated component, or document an API.

  • Avoid cosmetic scope creep: Do not reformat entire unrelated files, alter lint rules, or reorganize folder structures unless the issue explicitly calls for it. Large diffs filled with whitespace changes obscure the core logic and trigger merge conflicts.
  • Split compound features: If an implementation requires a database migration, an API endpoint, and a complex UI, consider opening separate PRs in logical stages. GitHub allows you to publish early progress as a draft pull request to signal that work is underway before requesting a final review.

2. Link the issue and use closing keywords

Always connect your pull request to an existing issue. This gives maintainers immediate context on why the change was proposed and ensures GitHub automatically updates the tracking board.

Use official GitHub linking keywords in your pull request description:

Closes #123
Fixes #123
Resolves #123

When your pull request is merged into the default branch, GitHub will automatically close the linked issue. If your PR only partially addresses a broader initiative, mention the issue number without a closing keyword (e.g., "Part of #123") so maintainers retain ownership of when to close it.

3. Write a self-explanatory description

Never leave the pull request body blank. A helpful description answers three core questions in under two minutes:

  • What changed: A concise bulleted summary of the code modifications.
  • Why: The background reasoning or bug reproduction details that necessitated the change.
  • How to verify: Exact terminal commands, test suites, or browser steps maintainers can follow to reproduce the fix locally.

4. Provide visual proof for UI changes

If your pull request modifies user interfaces, styles, or interactive components, always include screenshots or a quick recording.

Capture both desktop and mobile viewports (e.g., at 390px width for smartphones), and test both dark and light modes if the application supports themes. Showing visual proof confirms you actually tested the change in a browser rather than assuming the styling rendered correctly.

5. Run tests, types, and lints locally

Never rely on the continuous integration (CI) pipeline as your personal linter. Pushing code that breaks static checks wastes maintainer CI runner minutes and clutters the commit history.

Before committing, run the project's local validation commands:

# Verify static typing
npx tsc --noEmit

# Run code style and lint checks
npm run lint

# Execute affected test suites
npm test

If the repository includes unit or integration tests, add test coverage for your new code paths. Demonstrating that your change has automated regression tests gives maintainers the confidence to hit merge immediately.

6. Respect project guidelines and commit hygiene

Every open-source project has its own conventions defined in CONTRIBUTING.md. Read it carefully before opening your pull request.

  • Commit messages: Follow the repository's style, such as Conventional Commits (e.g., feat(auth): ... or fix(api): ...).
  • Sign-off trailers: Many repositories require a Developer Certificate of Origin (DCO). Ensure your commits include a DCO sign-off trailer using git commit -s.

7. Respond graciously to review feedback

Code review is a collaborative discussion, not a personal critique. When a maintainer requests adjustments:

  • Acknowledge and clarify: If a suggestion is unclear, politely ask for guidance rather than guessing.
  • Keep branches synced: If upstream changes while your PR is under review, use GitHub's branch update mechanism or rebase against upstream main to ensure a clean merge.
  • Notify when ready: After pushing requested changes, leave a brief comment summarizing what was updated so the reviewer knows it is ready for another look.

How pull request quality powers your DevTrack score

In DevTrack, pull request activity is a primary signal of real-world impact. The DevTrack score allocates 30% of its weight to Impact—measuring merged pull requests and constructive code reviews across repositories. By focusing on concise, well-documented contributions that maintainers merge quickly, you maximize your productivity velocity, level up faster, and climb the public leaderboard.

Quick answers

How small should an open-source pull request be?
Ideally under 200 to 400 lines of code focused on a single issue. Smaller PRs are reviewed and merged substantially faster than multi-file refactors.
Which keywords automatically close an issue on GitHub?
GitHub supports 'Closes #123', 'Fixes #123', and 'Resolves #123' (and their past-tense variants). When merged into default branch, GitHub automatically marks the issue closed.
What should I do if a maintainer requests changes?
Review the comments carefully, implement the requested adjustments, run local tests to verify nothing broke, push the commit to your branch, and reply politely to confirm the updates are ready.
How does merged PR activity impact my DevTrack score?
Merged pull requests contribute to the Impact dimension, which represents 30% of your overall DevTrack score, as well as providing 50 XP per pull request toward your lifetime level.