有没有办法以非交互方式挤压一些提交?

有没有办法以非交互方式挤压一些提交?

问题描述:

我试图压扁一系列的提交 - HEAD到HEAD〜3。有没有一个快速的方法来做到这一点,或者我需要使用rebase --interactive?

I'm trying to squash a range of commits - HEAD to HEAD~3. Is there a quick way to do this, or do I need to use rebase --interactive?

确保您的工作树是干净的,然后

Make sure your working tree is clean, then

git reset --soft HEAD~3
git commit -m'new commit message'