Lately, I jumped into an e-commerce UI template from Algolia. According to GitHub, I can either fork the repository or use it as a template. The difference seems to be that a template is not made for fetching the upstream of the original repository. I am a bit confused about why I should use it as a template when I pretty much lose access to future updates. Should I not just fork the repository instead and potentially get some neat updates?
-
4Did you read e.g. docs.github.com/en/repositories/…, which explains the differences?– jonrsharpeCommented Apr 5, 2022 at 19:30
-
I understand that it is convenient to have a fresh commit history and all that, but why does using a template restrict the user from fetching the upstream of the original repository? It would seem handy to me to get some updates. I guess that it would mess up the fresh commit history?– user9808476Commented Apr 5, 2022 at 19:35
-
2You can't have both. Nothing would stop you adding the upstream remote and cherry-picking applicable commits, but how long are you going to keep the your repo close enough to the template for them to apply cleanly anyway?– jonrsharpeCommented Apr 5, 2022 at 19:40
-
Thanks for your answer. I feel like I know enough now. It might indeed be a total nightmare to adapt to a completely new version of the template.– user9808476Commented Apr 5, 2022 at 19:44
-
1The reason you cannot have both is a technical issue that is intimately tied to Git's internal structure for commits. I myself would almost always use a fork (I see little value to GitHub's peculiar template system) and where I didn't use a fork I'd probably clone the original repository, use filter-branch or filter-repo, and turn that into my clone rather than using GitHub's peculiar template system.– torekCommented Apr 5, 2022 at 19:44
Add a comment
|
1 Answer
The difference between a fork and a template is that when you fork it's meant to contribute to the parent repository. Here are some of the pros/cons of each
Fork
Pros
- Be able to fetch upstream
- Able to open PRs to contribute to the head repository.
Cons
- Some features like visibility are unable to be changed.
Templates
Pros
- Can change all settings
Cons
- Unable to fetch upstream
- Able to open PRs to contribute to the head repository.
-
1Note that this isn't actually true though. A fork is not "meant to contribute to the parent", it's just a fork, so it lets you send PRs to the parent. Also, because fetching is a
git
opreation, not a github-specific thing, you can always fetch from any upstream as long as you added their repo as a remote. Commented Aug 9, 2022 at 22:17 -
@Mike'Pomax'Kamermans I do know that fetching is not specific to Github but there wasn't a point including making the head repo a remote since the OP is talking specifically about Github.– EthanCommented Aug 9, 2022 at 22:29