Files
30-seconds-of-code/snippets/discard-uncommitted.md
2021-04-13 21:10:59 +03:00

18 lines
351 B
Markdown

---
title: Discard uncommitted changes
tags: branch,intermediate
---
Discards all uncommitted changes to the current branch.
- Use `git reset --hard HEAD` to reset the local directory to match the latest commit and discard all unstaged changes.
```shell
git reset --hard HEAD
```
```shell
git reset --hard HEAD
# Discards all unstaged changes
```