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?
Asked
Active
Viewed 99 times
2 Answers
1
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..

mrutyunjay
- 6,850
- 7
- 25
- 35
0
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