Pull Request Template
The Pull Request template is a standardized document designed to help developers submit high-quality Pull Requests (PRs). By providing a consistent format, the template enables team members to more efficiently understand and review code changes. Below is a guide for creating and using GitCode Pull Request templates.
Creating a Pull Request Template
-
Select Template Location:
You can place the PR template in the
.gitcode/
folder at the root of your project, or create aPULL_REQUEST_TEMPLATE.md
file in thedocs/
or.gitcode/PULL_REQUEST_TEMPLATE/
folders. If you create multiple template files in the.gitcode/PULL_REQUEST_TEMPLATE/
folder, GitCode will provide a list of these templates for contributors to choose from when creating a PR. -
Write Template Content:
Write the content of the template in the
PULL_REQUEST_TEMPLATE.md
file. You can include basic header information, issue description, change type, test instructions, and any additional notes or explanations. Ensure that you prompt contributors to provide all the information you believe would be helpful for the review. You can configure front-matter information in the new.md
file, including the PR template title, specified assignee, and specified labels. Additionally, add the main body content to the new.md
file, which will be pre-filled into the description when users create a PR.Example Template:
---
title: "【PR Template】:"
labels: ["fix bug"]
assignees: 'username'
---
# Pull Request Template
---
## Description
Please provide a high-level explanation of this Pull Request.
## Type
- [ ] Bug Fix
- [ ] New Feature
- [ ] Code Style Update (Formatting, Local Variables)
- [ ] Refactor (i.e., not a new feature nor a bug fix)
- [ ] Build Process or Auxiliary Tool Changes
- [ ] Documentation Updates
## How to Test
Describe the steps to test this change, including which files need to be modified.
## Checklist:
- [ ] My code follows the coding style of this project
- [ ] I have tested my code myself
- [ ] I have updated the corresponding documentation
- [ ] I have updated the corresponding changelog as needed
- [ ] I have correctly used type labels in the title (e.g., `feat:`, `fix:`)
## Additional Information
Add any other relevant information related to this Pull Request. -
Using the Template:
Once you have created the template, GitCode will automatically fill the template content into the PR description box when contributors create a Pull Request. Contributors should fill in all relevant information according to the prompts in the template.
Introduction to Front-matter
Currently, we support the following markdown front-matter configurations:
Field | Description | Notes |
---|---|---|
title | Pre-set PR Title | Use double quotes if containing Chinese |
labels | Labels for the PR, supports multiple | Use square brackets for multiple; labels that do not exist will not display when creating a PR |
assignees | Default assignee for PR merge | Assignee's username |
Considerations
- Clarity: Ensure that your template is clear and concise so that contributors can easily understand and follow it.
- Flexibility: Encourage contributors to follow the template but also allow some degree of flexibility. Not every section must be filled by every contributor.
- Maintenance: Regularly update your template as the project evolves to ensure it remains relevant and helps achieve your project goals.
By providing a clear and organized Pull Request template, you can improve the quality of the project, accelerate the PR review process, and help contributors participate more effectively in the project.