Question

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.

Was it helpful?

Solution 2

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.

OTHER TIPS

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.

Maybe it's as simple as

git clone <boilerplate>
cd <boilerplate>
rm -fr .git
git init
git add .
git commit -m 'Project initialization from <boilerplate>'
git clone -o <cloned_repos_name> <boilerplate> <yourProjectName>
cd <yourProjectName>
git remote add origin <your_Project_Git_URL_Location>
git remote rm <cloned_repos_name>

In any case, one can use git remote -v, to see the current remote git push and fetch repos. In addition, one can add new git repos url and remove those unwanted using "git remote rm ".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top