Skip to main content
Repository templates are reusable blueprints for new projects. They provide a consistent project skeleton—directory layout, configuration files, documentation, and starter code—so teams can create new repositories that follow organizational standards from day one.

How repository templates work

  1. Create a repository containing the files, directories, and any starter content you want every new project to include.
  2. Enable the repository’s template setting (often found in the repository options or settings).
  3. Anyone with appropriate access can create a new repository from the template by clicking the Use this template button. The new repository is generated instantly using the template’s content.
What gets copied?
  • The entire directory structure and all files from the template’s default branch are copied into the new repository.
  • Some hosting platforms may offer options to include additional branches at creation time, but the default branch is what is copied by default.
  • The new repository starts with a fresh commit history; commits from the template are not preserved.
The image is a flowchart explaining how repository templates work, with three steps: Designation, Generation, and What is copied.
Quick steps to enable and use a template (example):
  1. Open repository Settings → Template repository → enable.
  2. Click Use this template.
  3. Choose a repository name, visibility, and create.
For teams automating repo creation, many platforms also provide APIs to programmatically generate repositories from templates.

Technical difference vs. forking or cloning

The critical technical distinction is commit history and synchronization.
  • A repository created from a template has no commit history from the template; it starts with a new, independent history.
  • Because the histories are unrelated, you cannot open pull requests to merge changes from the original template into the repositories generated from it.
  • Templates are intended to provide one-time scaffolding at creation time, not to keep derived repositories synchronized with the source.
The image describes repository templates, highlighting two key aspects: "Unrelated Histories," indicating a template creates a clean repo without commit history, and "No Merging or Pull Requests," meaning changes can't be merged between the template and new repo.
Use a repository template to standardize project setup and generate fresh repositories with consistent scaffolding. If you need ongoing synchronization between a source repo and its derivatives, use forks, submodules, or a CI-driven synchronization workflow instead.

Comparison: Template vs Fork vs Clone

When to use templates

  • Starting a new project that must follow organizational standards.
  • Bootstrapping repositories for consistent CI/CD, licensing, CODEOWNERS, or README structure.
  • Providing a predictable developer onboarding experience with starter code and docs.
Summary: Repository templates are ideal for enforcing consistent project structure and generating new repositories with a clean history. They are not a mechanism for ongoing synchronization between template and derivative repositories—use forks or other workflows when shared commit history and ongoing merges are required.

Watch Video