About repository templates
You can create a template from an existing repository. Anyone with access to the template repository can create a new repository based on the template with the same directory structure, branches, and files. For more information about creation of a repository template, see "Creating a template repository."
Tip
You can also create a repository from a template using the GitHub CLI. For more information, see "gh repo create
" in the GitHub CLI documentation.
You can choose to include the directory structure and files from only the default branch of the template repository or to include all branches. Branches created from a template have unrelated histories, which means you cannot create pull requests or merge between the branches.
Creating a repository from a template is similar to forking a repository, but there are important differences:
- A new fork includes the entire commit history of the parent repository, while a repository created from a template starts with a single commit.
- Commits to a fork don't appear in your contributions graph, while commits to a repository created from a template do appear in your contribution graph.
- A fork can be a temporary way to contribute code to an existing project, while creating a repository from a template starts a new project quickly.
For more information about forks, see "About forks."
Creating a repository from a template
-
On GitHub, navigate to the main page of the repository.
-
Above the file list, click Use this template.
-
Select Create a new repository.
Note
Alternatively, you can open the template in a codespace and publish your work to a new repository later. For more information, see "Creating a codespace from a template."
-
Use the Owner dropdown menu to select the account you want to own the repository.
-
Type a name for your repository, and an optional description.
-
Choose a repository visibility. For more information, see "About repositories."
-
Optionally, to include the directory structure and files from all branches in the template, and not just the default branch, select Include all branches.
-
Optionally, if the personal account or organization in which you're creating uses any GitHub Apps from GitHub Marketplace, select any apps you'd like to use in the repository.
-
Click Create repository from template.