Exercise – Create Your First Pull Request
You’ve learned how to create a pull request (PR) when there are guidelines provided, either in a PR template or a CONTRIBUTING file. But what if a project doesn’t offer such guidance or documentation on conventions to follow?
Describe Your Changes
To write a good commit message—and therefore a good pull request—follow these best practices:
- The subject line of your Git commit message should complete the following sentence:
If applied, this change will: . - Include a concise description of the change using the present imperative tense. For example, use add rather than added or adds.
- Limit your subject line to 50 characters.
- Start with a capital letter and don’t end with a period.
- You can use emojis in your subject line and mention other GitHub users with @, but not everyone appreciates this lighter style.
For the body of the message and the pull request description, continue using the present tense. Be sure to include the motivation behind the change. Compare your modification to the previous behavior. Use the available space to explain the what and why, rather than the how.
Your commit message should be as clear and precise as the content you’re submitting. Submit small, isolated sets of changes. This practice increases the chances that your changes will be accepted into the project.
Add Granularity
Before submitting your pull request, check the sidebar to see how to complete it:
- Select Reviewers or Assignees if you know the project team’s structure.
- Add labels if there are instructions about them in the CONTRIBUTING.md file. Labels serve as visual cues for what you’re trying to accomplish. A maintainer may also add one or more labels.
Here are some labels used in this Learn module’s repository:
- Bug (red): Something isn’t working
- Documentation (blue): Improvements or additions to documentation
- Duplicate (gray): This issue or pull request already exists
- Enhancement (blue-green): New feature or request
You can also link issues in the sidebar so that merging the pull request automatically closes the corresponding issue.
You can customize your subscription to the discussion thread notifications. Some PRs receive many comments, reviews, and CI/CD-related notifications. You can choose from:
- Not subscribed: You only receive notifications if you participated or were mentioned with @.
- Subscribed: You receive all notifications for this pull request.
- Custom: You’re notified only for the events you select.
Exercise
Using the First Contributions project, practice forking, cloning, and submitting a pull request.
The First Contributions project aims to “help beginners make their first contribution.” It offers guides for using the command line as well as several graphical user interfaces (GUIs). The project also supports multiple languages. Don’t forget to check the Translations folder.
With the lessons from previous units and this one in mind, return to a pull request you recently opened. Or go to the Pull requests tab of a project you follow. Observe how a good title can make all the difference. Consider updating a pull request accordingly. Put as much care into writing your PR as you did into modifying the project. Your efforts will help maintainers categorize and prioritize community contributions.
Bonus
Users interact with products in various ways: keyboard, mouse, touchscreen, voice command, etc. It’s best to use generic verbs that suit all interaction types. For example, use select instead of click or drag.