News for hackers. Stuff that matters.
Re:Generate new repositories with repository templates by edjrage on Saturday June 08, 2019 @02:11PM (#20134026)
I don't understand. What's the difference between this and just cloning (not forking) a repo? If it's the same, why not just add a button called "clone" that appears in _all_ repos?
Re:Generate new repositories with repository templates by joshvm on Saturday June 08, 2019 @03:52PM (#20134706)
When you fork a repository on Github, the website retains the association between the original and forked repos. But there are also artificial limitations e.g. Github forks can't be private when there's no technical reason that couldn't be the case. A forked repo is fundamentally just a clone with a different origin (i.e. changes get committed to a new place). What we think of as "forking" is the user experience that services like Github provide. If you clone a repository and then make a new project on Github with it, Github has no way of identifying that what you've done is technically a fork. It could obviously, but it doesn't.

Templating is basically the same thing, but it's more like clone a repository, delete the .git folder, run git init, and then associate the repo with your account. Except this all happens transparently on Github's servers and what you end up with is a clean new project with an "initial commit".

So in a sense whether you fork or template, you're still cloning a repo, but what happens after you clone is different in each case (and is also different from "just" cloning).

Re:Generate new repositories with repository templates by tyrust on Saturday June 08, 2019 @02:14PM (#20134053)
The biggest benefit will probably be for new programmers following a tutorial that provides a template. The word "clone" means nothing to them. They just want to copy and build off of this project on their own GitHub.

Yes, it does sacrifice some learning about git, but once you get someone hooked on programming they will be able to learn the tools later.

Re:Generate new repositories with repository templates by phreack on Saturday June 08, 2019 @02:50PM (#20134274)
I don't get it either, is it literally the same thing a a a clone with a different name?
Re:Generate new repositories with repository templates by imran3740 on Saturday June 08, 2019 @03:08PM (#20134395)
No, this does not preserve the history of the repo, just gives a single commit with the existing files. You might also think of this as cloning, then squashing down the entire history (well, everything in master anyways) to a single (root) commit.
Re:Generate new repositories with repository templates by RyJones on Saturday June 08, 2019 @03:46PM (#20134665)
Maybe I remember incorrectly, but I thought the template came from the default branch?
Re:Generate new repositories with repository templates by phreack on Saturday June 08, 2019 @06:11PM (#20135519)
Oh I get it now, thanks!
Re:Generate new repositories with repository templates by AtlasBarfed on Saturday June 08, 2019 @04:31PM (#20134961)
Templates are a copy of a non empty word document

Cloning is a word document with versions turned on that copied all the previous versioning information

Re:Generate new repositories with repository templates by elygre on Saturday June 08, 2019 @02:59PM (#20134329)
Wouldn't clone keep the entire history of the original repo, while this gives a single initial commit?
Re:Generate new repositories with repository templates by onion2k on Saturday June 08, 2019 @05:18PM (#20135245)
'git clone --depth=1' will only clone the latest HEAD so you won't get the history.