Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitHub: What is the difference between Template and Fork concepts and when to use?

I was wondering how GitHub templates differentiates from forks and why should I use them instead of forking a repository?

like image 912
Furkan Yavuz Avatar asked May 29 '20 08:05

Furkan Yavuz


People also ask

What is the purpose of forking on GitHub?

A fork is a copy of a repository. Forking a repository allows you to freely experiment with changes without affecting the original project.

When should you fork a repository?

Most commonly, forks are used to either propose changes to someone else's project to which you do not have write access, or to use someone else's project as a starting point for your own idea. You can fork a repository to create a copy of the repository and make changes without affecting the upstream repository.

Should I fork or clone GitHub?

It is a better option to fork before clone if the user is not declared as a contributor and it is a third-party repository (not of the organization). Forking is a concept while cloning is a process. Forking is just containing a separate copy of the repository and there is no command involved.

What is the difference between forking and branching in GitHub?

Branching is to create another line of development in the project without affecting the main branch or repository. Forking, on the other hand, is to make a clone of the repository on your GitHub account without affecting the main repository.


Video Answer


2 Answers

As far as I understood, you can't pull updates from templates the same way you can pull them from forks. You are unable to push changes to the forked repository as well.

Templates are intended to use a repository as-is, and to use it as a boilerplate to build for example a website. It's not meant to be up-to-date with the main repository.

Edit: Also you can't fork your own repositories on GitHub; you can however use your own templates.

like image 69
CreepSore Avatar answered Oct 11 '22 10:10

CreepSore


These are included in the official docs as well link

  • 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.
like image 36
Chamara Liyanage Avatar answered Oct 11 '22 12:10

Chamara Liyanage