Skip to main content
Create a repository-level GitHub pull request template to ensure contributors and maintainers provide consistent, useful information when opening PRs. A PR template improves review speed, clarifies the purpose of changes, and documents required checks before merging. This guide uses an example repository named ghs-guardrails-demo (a Node.js project with package.json). To configure a repository-level template, add the Markdown file at .github/pull_request_template.md. When present, GitHub will populate the new PR description with the template contents by default.

Why use a pull request template?

  • Standardizes the information required for a PR (description, tests, checklist).
  • Reduces back-and-forth by surfacing important details up-front.
  • Encourages contributors to run tests and follow project conventions.
  • Helps maintainers triage and review changes faster.

Steps to add a repository-level PR template

  1. Create the .github directory (if it doesn’t already exist).
  2. Add pull_request_template.md inside .github.
  3. Populate the file with the template content that guides contributors.
  4. Commit and push the new file to your repository (preferably on a feature branch and open a PR into main).
Example commands to create the directory, add the file, and push via Git:
Best practice: Prefer creating a branch and opening a PR rather than committing directly to main. Bypass rules should be used sparingly and only when necessary.
If your workflow allows committing directly to main, be mindful of branch protection and bypass rules. Avoid bypassing protections unless there is a documented and approved reason.

Example pull request template

Save the following content to .github/pull_request_template.md:

Template anatomy (what each section achieves)

Commit and push guidance

  • Preferred flow: create a feature branch, add the file, open a PR into main.
  • If you must add directly to main (and your repo allows it), the GitHub UI supports creating files directly in the main branch: choose “Commit directly to the main branch” when saving the file.
  • To test the template: open a new pull request and confirm the content from .github/pull_request_template.md appears in the PR description.
Use this template as a starting point — adjust fields and checklists to match your project’s development, testing, and release standards.

Watch Video