Repository is something like a folder for a project in GitHub. The repository contains all the files that belong to the project. It stores the entire history of project changes, which is very important. Using the Issues tab, you can create defects, improvements, and questions for the project. Using Projects , you can create Kanban boards to track the status of issues, their implementation and planning. Template repository is a template based on which you can create new repositories. A template that contains common code for all repositories. |
1. Issue template
Here you need to describe the rules for creating an issue in the repository: what they should be called, what the label will be, who will be assigned to it. When creating a new Issue, the following options will be offered:- Bug report - creating an issue to describe a defect in the project;
- Feature request - proposal of a new idea for a project;
- Improvement request - proposal for improvement on the project;
- Custom issue template - if other options do not work, you can use an empty template.
2. License
The license under which the project is written. It is necessary so that those who will use the project know what is guaranteed and what is not. For example, the Apache License 2.0 says the following:3.README
This is a description of the project, its calling card. Everything that needs to be said about the project should be here. Of course, it will need to be described each time, taking into account the specifics of the project, but the headings will be the same. For example:- Overview - a brief description of the project;
- Usage - how to use the project;
- Building - how to launch a project, what is needed for this;
- Troubleshooting - this describes what problems you may encounter and how to solve them;
- Release Notes - description of changes depending on the version;
- Authors - don’t forget about your loved ones;
- Contributing - a description of how you can participate in the development of the project;
- Code of Conduct - description of the rules of participation;
- RELEASE_NOTES - a file in which all changes for new versions are recorded. It’s a good practice to put this in a separate document and store a link in the README;
- CONTRIBUTING is a file that describes how you can contribute to the development of this project. Made as a separate file for the Contributing header in the README;
- CODE_OF_CONDUCT - a file that describes the rules for participating in the development of the project;
- Pull Request template - a template for those who will create a pull-request.
Practice: creating your own template
As they say, let's move from words to action. Now, using an example, I will show you how to create your own template.-
The first thing you need is an account on GitHub / register there .
-
Create a new repository: to do this, click + in the upper right corner
-
When creating, fill in:
- Repository name - in my case repository-template;
- Description — brief description of the project;
- We leave Public, although you can select Private;
- Check the README initialization box:
-
Select the license under which the project will be:
Since in my case the template is general, gitignore is not needed: it will be added for a specific project and programming language.
Therefore, click Create Repository , thereby completing the creation process. The system will automatically take us to the newly created repository.
-
Filling out the Community Profile : in the created repository, go to the Insights tab and select Community :
As you can see, all that remains is to fill out the Code of Conduce, Contributing, Issue Template, Pull Request template.
Using the Code of Conduct example, we will show how to add them to a project.
Click add , the system prompts you to select Contributor Covenant or Citizen Code of Conduct :
I select the first one and click Review and Submit .
Next, you can edit this file and commit it.
At the bottom, select the Commit directly to the master branch option and click Commit new file :
As a result, if we go back to the Community Profile , we will find that Code of Conduct is marked as added:
Contributing and Issue Template are added in a similar way, so I won’t show this. Do it yourself ;)
-
Add Pull Request template .
But let's talk about this separately.
I don’t know why GitHub hasn’t added the same convenient option for setting up the Pull-Request template, so you’ll have to study the
documentationand add it manually.To do this, click Create new file in the root of the repository :
The file name should be: .github/pull_request_template.md .
We add what we need to the template and click Commit new file , as we did above. I wasn't going to reinvent the wheel and found an example that seemed quite usable to me.
This way the entire Community Profile will be filled in:
-
Add a Template Repository marker .
To do this, go to the Settings option in the repository and check the box where it says Template Repository:
And that’s it, the template for creating new projects is ready. Thus, we will save a lot of time in the future when we need to create new projects. This will also help you not to miss important details, since it often happens that you forget to add something, for example a license or a clear template for an issue.
How to use Template Repository
There are two options for use:
-
When a template is owned directly by you: When creating a new repository, you will be given the option to create from a template from the list of templates you own:
-
When the template is foreign: there are no special problems here either. Go to that template and click the Use this template button . Here I will use the animation from the official doc:
Let's sum it up
In this article we looked at:- what is GitHub repository;
- what is Template repository;
- what should be in the Template repository;
- how to create a Template Repository;
- how to use Template Repository.
useful links
- Organization with all the templates I created
- GitHub Blog: Generate new repository with repository templates how to create a template for repositories
- GitHub Help: About repositories about what repositories are.
- GitHub Help: Creating a repository from a template how to create a new project based on a template
- GitHub Help: Licensing a repository description of licensing for projects
- GitHub Help: Create a repo description of creating a repository
- Open Source Guides tips for creating/describing open-source projects.
- GitHub Help: adding a pull-request template - creating a template for pull-requests.
More of my articles
- Debug in Intellij IDEA: a guide for beginners
- Guide to creating a client for the Skyscanner API and publishing it in jCenter and Maven Central [Part 1]
- Guide to creating a client for the Skyscanner API and publishing it in jCenter and Maven Central [Part 2]
- Creating an air ticket price monitoring system: a step-by-step guide [Part 1]
- Creating an air ticket price monitoring system: a step-by-step guide [Part 2]
- Creating an air ticket price monitoring system: a step-by-step guide [Part 3]
- Logging: what, how, where and with what?
- How an interview test turned into an open-source library
- History of success. 20 hours of programming per week, master's degree and personal life
- How to find a job? Tips for sending out resumes
GO TO FULL VERSION