# Undoing things in git
URL: https://wwadd.dev/moves/git-http/git-undo

Pick by blast radius: `restore` for files, `reset --soft` to re-do a commit message, `revert` for anything already pushed, `reflog` when you think work is gone.


```bash
git restore src/app.ts           # discard local file changes
git restore --staged src/app.ts  # unstage, keep changes
git commit --amend               # fix the last commit
git reset --soft HEAD~1          # undo commit, keep changes staged
git revert <sha>                 # safe undo of a pushed commit
git reflog                       # find "lost" commits
```

## Related Moves
- [Git commands for daily work](https://wwadd.dev/moves/git-http/git-daily)

