Question

I'm using a boilerplate for any new projects I make. However the commits I made in the boilerplate gets through to the new project. How would I go about to simply have an "Intial commit" which includes everything in one commit and removes the old commit history?

Was it helpful?

Solution

use rebase command for this

git rebase -i HEAD~N

N is the number of commits you want to meld into one.. And then do a force push..

OTHER TIPS

you could follow the question "git: how to squash the first two commits?", and squash the n-commits on your new repo.
The script is here, can squash the first commits while replaying the rest of the commits you want to keep in the history of the new repo.

git clone boilerplaterepo newrepo
# apply the script for git reset --soft $1 everything

The solution uses git reset --soft, and is an example of one of the "Practical uses of git reset --soft?".


If you want a solution based on rebase --interactive (less practical, as it involve a manual step), don't forget the --root option (git 1.7.12), in order to rebase down to the root commit.

 git rebase -i --root
 git push -f
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top