Skip to content

Git : How to squash the last commits into a single new commit

Posted in Git

This code squash the last three commits into a single new commit.
The soft reset just re-points HEAD to the last commit that you do not want to squash.

git reset --soft HEAD~3 &&
git commit -m "new commit message"

One Comment

  1. My method relies on using a tag to note when the most recent squash merge was done, and git log –ancestry-path to pull the changes since then into a single merge comment.

    29 août 2016
    |Reply

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *