> For the complete documentation index, see [llms.txt](https://hemantajax-2.gitbook.io/git-step-by-step/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hemantajax-2.gitbook.io/git-step-by-step/commit.md).

# Commit

## Revert Commit

```
git log ( get hash few characters )
git revert <git hash (few char)>
git revert HEAD ( revert to last commit )
```

## Alter commit history

Warning! - never want to do when changes pushed and used by other devs

```
// add new changes to recent commit without modifying commit message
git commit --amend --no-edit

// add new changes to recent commit with new commit message 
// ( recent commit message would be lost )
git commit --amend
```
