Amar Prakash Pandey - ᕦ(ò_óˇ)ᕤ

How Not to Open a Pull Request – And How to Do It Right

banner

Picture this: You’re maintaining an open-source project, and you receive a pull request that promises to revolutionize your codebase. Security improvements, architectural enhancements, performance optimizations – it has everything! Sounds perfect, right?

That’s exactly what happened with my project spot-optimizer. The contributor was skilled, the intentions were great, but there was one major problem:

Changes Count
Lines Added 2,200+
Lines Removed 1,200
Files Changed 25
Total Commits 15

Despite the valuable improvements it offered, I had to close it. Not because of code quality or the contributor’s skills, but because its sheer size made it impossible to review effectively. It tried to solve too many problems at once, altered core design decisions, and would have required days of careful review.

This is a common scenario in open source, and it’s a pattern I’ve seen repeatedly over six years of project maintenance. Today, I’ll share how to avoid this pitfall and create pull requests that maintainers will love to review and merge.

This post explains why PR size matters and provides practical guidelines for making your contributions more likely to be merged — in any open source project.


Why Giant PRs Are a Problem


Actionable Advice for Contributors

1. Avoid Massive Pull Requests

2. Respect Existing Design Choices

3. Use Clear, Logical, Atomic Commits

Here’s an example of good vs bad commit history:

# ❌ Bad Commit History
git log --oneline
c345678 final fix
d901234 actually final fix
e567890 formatting

# ✅ Good Commit History
git log --oneline
a123456 feat(auth): add OAuth2 support for Google login
b789012 test(auth): add integration tests for OAuth flow
c345678 refactor(auth): extract OAuth config to separate file
d901234 docs(auth): update README with OAuth setup steps

4. Communicate Before Refactoring

5. Be Empathetic: Think Past the Code


What Maintainers Can Do to Help

It’s not just about setting rules for contributors. If you’re a maintainer, try to:


A Simple Checklist for Great PRs

Best Practices ✅ Common Pitfalls ❌
Discuss big changes in issues first Launch major rewrites without context
Respect existing structure Assume everything should be changed
Keep PRs small and focused Bundle unrelated changes into one PR
Write helpful, consistent commit messages Use vague or repeated “fix” commits
Test each part before submitting Submit code that breaks or fails CI

Final Thoughts

Great open source contributions aren’t just about code — they’re about context, communication, and care. The best PRs solve a clear problem, are easy to review, and respect the structure and goals of the project.

If you care about your contribution getting merged:

We’re all here to make things better — together.


Lastly, thank you for reading this post. For more awesome posts, you can explore my other articles here, and follow me on Github — amarlearning.

#open-source #git #best-practices #collaboration #code-review

Comments