> For the complete documentation index, see [llms.txt](https://gittutorial.gitbook.io/practical-git-via-gitextensions/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gittutorial.gitbook.io/practical-git-via-gitextensions/rewrite-history/how-to-squash-last-few-commits.md).

# 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.<br>

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.<br>

![](/files/-LS9gH7zTvdLmUC6QgE8)

Commmand line:

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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://gittutorial.gitbook.io/practical-git-via-gitextensions/rewrite-history/how-to-squash-last-few-commits.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
