DEV Community

loading...

Answer: Squash my last X commits together using Git

boyukbas profile image baris ・1 min read

You can do this fairly easily without git rebase or git merge --squash. In this example, we'll squash the last 3 commits.

If you want to write the new commit message from scratch, this suffices:

git reset --soft HEAD~3 &&
git commit

If you want to start editing the…

</p>





That's cool!

Discussion (0)

pic
Editor guide