> For the complete documentation index, see [llms.txt](https://yu-sun.gitbook.io/essential-git-for-scientists/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://yu-sun.gitbook.io/essential-git-for-scientists/cookbook/reset.md).

# Reset

All types of reset will move the `HEAD` pointer to the commit specified.

```
-o-o-o-o-o-o-o   Original: HEAD pointing to the last commit
             |

-o-o-o-o-o o-o   Reset: HEAD replaced at an earlier commit
         |

```

The difference is what happens to the working tree and the staging index.

* `--soft`: no rollback on either.
* `--mixed`: keep the working tree, roll back the staging index; **default** option;
* `--hard`: roll back both, like subsequent commits never happen. It's like `git checkout` with an *attached* `HEAD`.

Right after the hard reset, if you have the SHA you can still get to later commits. But if you do further development, subsequent commits might be lost.
