Is there a way to squash a number of commits non-i

2019-01-10 03:05发布

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?

8条回答
姐就是有狂的资本
2楼-- · 2019-01-10 03:44

Make sure your working tree is clean, then

git reset --soft HEAD~3
git commit -m'new commit message'
查看更多
Anthone
3楼-- · 2019-01-10 03:44

To squash everything since the branch was forked from master:

git reset --soft $(git merge-base --fork-point master) \
  && git commit --verbose --reedit-message=HEAD --reset-author
查看更多
登录 后发表回答