DEV Community

Cover image for Create templates in Github
Gabriela Mendes
Gabriela Mendes

Posted on • Updated on

Create templates in Github

Hello my fellow programmers



Today I’m going to show you how to create a simple template on Github, it’s a nice feature and today I’ve already told some friends about it, to my surprise most of them don’t know it.
It's easy to create and you'll also save some time when creating a project that has a configuration that you always use.
Anyway, let's get start:

Requirements

  • For this tutorial do you need at least have a Github account, if you dont have click here and create one :)
  • Basic git knowlage

1) Sign in on Github and in the top of the page click in the + button, and select "New repository"
step1

2) Name your repository in the Name repository input, the name must be unique.
After that click in the Create repository
step2

3)Now the repository is alive, click in the gear icon for the repository settings, this is the most important part.
step3

4)In the settings tab, mark the template repository checkbox, just that.
step4

5) Now we need to add some code for this repository can serve his purpose, I'll use sample node repository for it, but you can use whatever the project you want ^-^
step5

Commit the code
step6
Add the remote repository link
step7
Push to the main or master branch
step8

6) Back in the github repository page, refresh and now we have some code, its time to use it. Click in the Use this template
step9

7) The page for create a new repository is more simple, you can name the new repository and copy other branchs besides the main(or master) template repository.
The Github will create a brand new repository, with the name you choose, all the code for the template, and if you select the option, all the branchs too.
step10

Conclusion

Thats it, to use your new repository proceed as usual, clone, change, commit and this absolutely not affect your template repository.


The sample template repository for this post here

Follow me on twitter @kappyh
My github

Thanks for the reading! 😃

1 year free cloud and discounts

** Credits for the post cover**
@perloov

Latest comments (0)