Skip to main content
Practice

2

deck

When to Use Pull Requests?

PR (Pull Request) is primarily used in the following situations:

  • As a way to share code changes with your team
  • To improve code quality through review and feedback
  • As the gateway for the code to eventually merge into the main branch
ExpressionMeaning
open a pull requestTo create a pull request so others can review and discuss your code
submit code for reviewTo send your code to be reviewed by team members or maintainers
request changesTo suggest that the author revise specific parts of the code
approve the PRTo confirm that the pull request is acceptable and can be merged
leave a commentTo write feedback or questions directly on the code or PR discussion
resolve conflictsTo fix overlapping changes between branches that prevent merging
merge the PRTo combine the pull request into the main branch
steps to reproduceA detailed list of actions that consistently cause a bug to occur
code snippetA small, focused section of code used for explanation or discussion

===

What is a PR Template?

Creating a template file in the .github/PULL_REQUEST_TEMPLATE directory can guide an author to maintain a consistent format when writing a PR.

It usually includes the following types:

  1. Feature Addition
  2. Bug Fix

Feature Addition PR Template Example

## Description
Briefly describe the feature you added.

## Related Issue
Closes #[issue-number]

## Changes
- Added ...
- Updated ...

## Screenshots (if applicable)
[Insert screenshots]

## Checklist
- [ ] Tests added
- [ ] Docs updated

A feature addition PR template should clearly communicate what was changed, why, and how.

===

Bug Fix PR Template Example

## Bug Description
What was the bug?

## Fix Description
How did you fix it?

## Related Issue
Fixes #[issue-number]

## Test Coverage
- [ ] Confirmed fix in local
- [ ] Added regression test

A bug fix PR template should explain the cause of the bug, the fix, and whether it has been tested.

===

Want to learn more?

Join CodeFriends Plus membership or enroll in a course to start your journey.