Pull Request Template
A Pull Request template is a standardized document used to help developers submit high-quality PRs. By providing a consistent format, the template allows 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
-
Selecting Template Location:
You can place the PR template in the
.gitcode/
folder under the project's root directory, 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.提示The template configuration must be placed in the default branch of the repository. If you create a template in another branch, the configuration will not take effect, and related features cannot be used by collaborating users.
-
Writing Template Content:
Write the content of the template in the
PULL_REQUEST_TEMPLATE.md
file. You can include some basic header information, problem description, type of change, testing instructions, and any additional notes or explanations. Ensure that contributors are prompted to provide all the information you think would be helpful for review. You can configure front-matter information in the newly created.md
file, including the title of the PR template, assigning a merger, specifying labels, etc. At the same time, add body content to the newly created.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)
- [ ] Refactoring (i.e., code changes that are neither new features nor bug fixes)
- [ ] 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 relevant documentation
- [ ] I have updated the corresponding changelog as needed
- [ ] I have correctly used type tags in the title (e.g., `feat:`, `fix:`)
## Other Information
Additional information related to this Pull Request can be added here. -
Using the Template:
Once you've 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 based on the template prompts.
Introduction to Front-matter
Currently, we support the following markdown front-matter configurations:
Field | Description | Notes |
---|---|---|
title | Preset title of the PR | Use double quotes if it contains Chinese |
labels | Labels for the PR, supports multiple | Multiple labels need to use brackets; if there are non-existent labels, the label will not be displayed when creating a PR |
assignees | Default assignee for merging | Assignee's username |
Considerations
- Clarity: Ensure your template is concise and clear so that contributors can easily understand and follow it.
- Flexibility: Encourage contributors to follow the template but also allow for a degree of flexibility. Not every part needs to be filled out by every contributor.
- Maintenance: Regularly update your template as the project evolves to ensure it remains relevant and helps achieve the project's goals.
By providing clear and organized Pull Request templates, you can improve the quality of the project, speed up the PR review process, and help contributors participate more effectively in the project.