Have you ever needed to ramp up on a project quickly to produce a product as soon as possible? Typically, development teams start out fresh by creating a brand new code project; however, creating new projects from scratch can forfeit time that would otherwise go into building out new features. A GitHub template can help developers reuse code to bring a product to production level at a much faster rate.

We use templates at Bytelion to help our startup clients achieve their goals in a smaller time frame. Check out this GitHub template for a Ruby on Rails API project we have created. In this post we will demonstrate how we created this template so you can get started with recycling your code!

4 Steps to Create a Template Repository

1. Create a new repository that will host the GitHub template

Creating a new repository is the first step to creating your first GitHub template. To create a new repository select the plus button from the top of the page and enter the required info. You can choose to share your repository with the public or you can keep it hidden between you and your team!

2. Generate your code for reusing as a template project

Once you have a repository created you can add any code that you would like to use as a template. In our example Rails template we chose to have a Rails API that will be ready to use, the only steps left are to create our models and controllers that will be used when the API is called by a client.

3. Mark the repository as a template

When the code in the project is complete, navigate to the settings tab in GitHub and select the option to mark the project as a template repository.

create github template4. Use the template to create a new project

To create a new GitHub repository with the template do one of the following. Create a new repository as shown in step 1 and select the template you would like to use. Or if using a public template, you can use the “Use this template” button on the repository page. As a result, you will have created your first GitHub repository!

use github templateNow that you have created your own template you can get started with reusing your own code to kickstart your projects! Have a template you would like to share with us? Let us know by sharing this post and mentioning us on Facebook, Twitter or LinkedIn!

Leave a Reply