跳到主要内容

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


  1. Select Template Location:

    You can place the PR template in the .gitcode/ folder at the root of your project, or create a PULL_REQUEST_TEMPLATE.md file in the docs/ 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.

    image-20250102110220080

  2. 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.
  3. 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.

    image-20250102110518395

Introduction to Front-matter


Currently, we support the following markdown front-matter configurations:

FieldDescriptionNotes
titlePre-set PR TitleUse double quotes if containing Chinese
labelsLabels for the PR, supports multipleUse square brackets for multiple; labels that do not exist will not display when creating a PR
assigneesDefault assignee for PR mergeAssignee'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.