문제

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?

도움이 되었습니까?

해결책

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..

다른 팁

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top