Pull request and issue templates in GitHub have proven to be extremely valuable to our workflows. We continue to refine them to remind us of our ever evolving best practices and continually improve our issue and pull request processes. A recent idea for an improvement to our pull request template left me faced with daunting the task of updating the template in all of our repositories.
After some searching, I found a comment with a link to a help page that explained how to create a default community conduct file.
You can add default community health files to the root of a public repository called
.githubthat is owned by an organization or user account. GitHub will use and display default files for any public repository owned by the account that does not have its own file of that type in any of the following places: The approach seemed too good to be true and didn’t mention issue or pull request templates specifically. I still gave it a shot, and it ended up working!
The approach is as follows:
- Create a public repository named
.githubwithin your organization.
- Create a
.githubfolder within that repository with issue templates, PR templates, etc, just as you would for templates in a normal repository.
- Go through your repositories and delete the template files you want your
.githubrepo templates to override.
That’s it! It is that simple. Now you can share templates across your organization and update GitHub templates in one place.
There are a couple caveats: If you override a single issue template, you will not inherit any other issue templates. There is no “merging” of issue templates. You are able to override issue templates, and still inherit pull request templates.
You can checkout our templates in our
This isn’t groundbreaking, but it is a simple win that is already making a big impact. We are now able to easily update a single template and see the benefits on all of our projects. Hopefully this sheds a light on some hidden functionality that doesn’t appear to be well documented, but has the potential to greatly improve your GitHub workflows.