DEV Community

Cover image for Start Open Source Contributions Now!
Arun Krish
Arun Krish

Posted on

Start Open Source Contributions Now!

✨ How to Write Commit Messages & Pull Requests for Open Source Contributions

Contributing to open-source projects on GitHub is a fantastic way to improve your skills, build your portfolio, and give back to the community.

But… before your code gets merged, maintainers need to understand what you’ve done and why.

That’s where clear commit messages and well-structured pull requests (PRs) come in.

In this post, we’ll walk through:

  1. Writing clean commit messages
  2. Creating pull requests that maintainers love
  3. A ready-to-use PR template for your future contributions

1️⃣ Writing a Good Commit Message

A good commit message should be short, descriptive, and consistent.

✅ Commit Message Format

<type>: <short description>

Enter fullscreen mode Exit fullscreen mode

Common commit types:

  • feat → new feature
  • fix → bug fix
  • docs → documentation change
  • style → formatting or styling changes
  • refactor → code improvements without changing behavior
  • test → adding or updating tests
  • chore → maintenance tasks

💡 Examples

fix: resolve crash when loading user profile
docs: update README with setup instructions
feat: add dark mode to settings page
Enter fullscreen mode Exit fullscreen mode

If you need to explain more:

feat: add search functionality to events list

- Implemented SearchBar component with debounce
- Updated EventList component to filter results in real-time
- Added unit tests for search feature
Enter fullscreen mode Exit fullscreen mode

Pro tips:

  • Keep the first line under 50 characters.
  • Use present tense (“add” not “added”).
  • Commit one logical change per commit.

2️⃣ Creating a Pull Request (PR)

A Pull Request is how you propose your changes to the main project.

Steps to create one:

  1. Fork the repository.
  2. Clone it locally:
   git clone https://github.com/<your-username>/<repo-name>.git
Enter fullscreen mode Exit fullscreen mode
  1. Create a new branch (don’t work on main):
   git checkout -b feat/search-bar
Enter fullscreen mode Exit fullscreen mode
  1. Make changes → commit:
   git add .
   git commit -m "feat: add search functionality to events list"
Enter fullscreen mode Exit fullscreen mode
  1. Push your branch:
   git push origin feat/search-bar
Enter fullscreen mode Exit fullscreen mode
  1. On GitHub, click "Compare & Pull Request".

3️⃣ Writing a Great PR Description

A PR description should explain what you did, why, and how to test it.

Here’s a PR template you can use:

## Description
Briefly explain the changes.

## Changes
- List key changes in bullet points.

## Screenshots / Demo (if applicable)
[Add screenshots or GIFs]

## Related Issue
Closes #<issue-number> (if fixing a bug or feature request)

## Checklist
- [ ] Code follows project style guidelines
- [ ] Tested locally
- [ ] Documentation updated if needed
Enter fullscreen mode Exit fullscreen mode

📌 Example PR

## Description
Added a search bar to the Events page to filter events by name in real-time.

## Changes
- Added SearchBar component with debounce to prevent excessive re-rendering
- Updated EventList component to filter events list
- Added unit tests for the search functionality

## Related Issue
Closes #45

## Checklist
- [x] Code follows project style guidelines
- [x] Tested locally
- [ ] Documentation updated
Enter fullscreen mode Exit fullscreen mode

🎯 Final Thoughts

  • Small commits = easier code review.
  • Clear PRs = faster approval.
  • Consistent format = happier maintainers.

Next time you contribute to open source, follow this guide — you’ll make life easier for both yourself and the maintainers. 🚀


If you found this helpful, save it for later and share it with someone starting their open-source journey! 💙

Top comments (1)

Collapse
 
arunkrish11 profile image
Arun Krish

Feel free to share your thoughts!