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
- Create the
.githubdirectory (if it doesn’t already exist). - Add
pull_request_template.mdinside.github. - Populate the file with the template content that guides contributors.
- Commit and push the new file to your repository (preferably on a feature branch and open a PR into
main).
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 themainbranch: choose “Commit directly to themainbranch” when saving the file. - To test the template: open a new pull request and confirm the content from
.github/pull_request_template.mdappears in the PR description.
Helpful links and references
- Creating a pull request template (GitHub Docs)
- Creating and editing files in your repository (GitHub Docs)
- GitHub branch protection rules