Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating new projects from an existing "boilerplate" repo

Tags:

git

github

I've created a Laravel "boilerplate" project which contains my commonly used features/libraries.

What's the correct git process for utilising this boilerplate as a basis for new projects? I can think of two options:

  1. Fork boilerplate to newproject and begin. I don't have any intention of pulling newproject changes back into boilerplate.
  2. Clone boilerplate and update the remote origin to a new clean repo.

I'm leaning towards the 2nd option, as it feels like a nice clean split from the boilerplate code. Will I be losing any cool git possibilities by doing this?

like image 626
Matt Stone Avatar asked Feb 15 '13 03:02

Matt Stone


1 Answers

Update June 2019, 6 years later:

See "Generate new repositories with repository templates "

Sharing boilerplate code across codebases is a constant pattern in software development.
Bootstrapping a new project with our favorite tools and directory structures helps programmers go from idea to “Hello world!” more efficiently and with less manual configuration.

Today, we’re excited to introduce repository templates to make boilerplate code management and distribution a first-class citizen on GitHub.

To get started, all you need to do is mark a repository as a template, and you’ll immediately be able to use it to generate new repositories with all of the template repository’s files and folders.

https://github.blog/wp-content/uploads/2019/06/repository-template.gif

Every template repository gets a new URL endpoint called /generate that allows you to distribute your template more efficiently


Original answer 2013:

Considering you will be storing your project on Github from one of the templates included in boilerplate GitHub project, I would:

  • Create a new empty repo on GitHub (no link with boilerplate, no need for a fork)
  • clone it
  • clone boilerplate in a separate location on your disk
  • copy the right template from the local boilerplate clone to your new locally cloned Github repo
  • (git add, git commit) Push that specific template back to your new Github repo.
  • start working from there
like image 157
VonC Avatar answered Sep 20 '22 08:09

VonC