Squashing Last Few Commits

If just want to squash last few commits we can do a Mixed or Soft reset to their parent commit and recommit the changes.

Note: with Mixed reset, we have to stage the files again, whereas Soft will keep the files in staging area.

For example, in below image, we want to squash the last two commits WIP: Continue Fix blah blah and WIP: Fix blahblah. We can right click their parent commit my awesome changes, select the Reset current branch to here, then select the Mixed:xxx option.

Commmand line:

git reset HEAD~2
git add <the files> # or use git add -a to add all files to staging area
git commit

Last updated