Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How should I proceed building an application after cloning a boilerplate?

Many frameworks offer a seed or boilerplate that can be cloned to jumpstart development of a new app. Often, the recipe goes something like

Step 1: Clone our fancy boilerplate that extends the power of this super easy and advanced framework by incorporating the industry's best practices while decoupling the framework from the hindrances we all thought were needed, providing you the cleanest possible slate to start building your super app.

git clone https://github.com/user/magic-super-easy-and-advanced-framework-seed

Step 2: Download and build in some extra bloat that couldn't be bundled with the magic we used to create the boilerplate but nonetheless is required and used by the industry's best practices which you will therefore also need to use to make your app the most super

...

Step 3: Start building your super app, just like that!

Step 4 (optional): Profit

What I think all of these boilerplate instructions are missing is the step for removing the boilerplate's git cruft. Wouldn't it be better if my new super app didn't have the history of the boilerplate? What is the proper way to clone a boilerplate but otherwise start the project fresh with a clean git history and no references to the boilerplate?

Note that unlike git workflow - using one repo as the basis for another, I'm not just looking for removing references to the boilerplate repo in git's remotes, but all references to and commit history of the boilerplate repo.

like image 570
drs Avatar asked Feb 13 '23 02:02

drs


2 Answers

If you want to delete your git history, the best way I can think of to do it is to do the following.

rm -rf .git
git init
git add .
git commit -m "whatever"

That way you clean out the old history, ensuring no bloat follows you around, and start from what you've got downloaded when you start your super app.

like image 195
Andy Avatar answered Feb 16 '23 00:02

Andy


When you don't want to import the whole history of a git repository, you can use

git clone --depth 1 <repository>

to create a so-called shallow-clone with only the most recent revision. Optionally you can also use --single-branch to omit any branches except master.

like image 29
Philipp Avatar answered Feb 16 '23 01:02

Philipp