2013-04-09 54 views
2

我为我制作的任何新项目使用样板。但是,我在样板文件中提交的内容会通过新项目。我该如何去简单地做一个“Intial commit”,它包含一个提交中的所有内容并删除旧的提交历史记录?将git提交转换为一个

回答

0

使用命令重订本

git的变基-i HEAD〜n的

N是要融合成一个.. 然后做力推提交数..

+0

谢谢,这正是我所需要的。 – 2013-04-09 13:34:23

0

您可以按照问题“git: how to squash the first two commits?”,并压缩你的新回购的n-commits。
script is here可以压缩第一次提交,同时重播您希望保留在新回购的历史记录中的其余提交。

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

该解决方案使用git reset --soft,并且是“Practical uses of git reset --soft?”中的一个例子。


如果你想基于衍合--interactive(不太实用,因为它涉及到手动工序),don't forget the --root option (git 1.7.12),为了重订下来到根提交的解决方案。

git rebase -i --root 
git push -f