Files
30-seconds-of-code/snippets/discard-uncommitted.md
Angelos Chalaris fb4b6fbc8e Update covers
2023-02-16 22:24:37 +02:00

21 lines
428 B
Markdown

---
title: Discard uncommitted changes
tags: branch
cover: arrays
firstSeen: 2021-04-06T11:11:08+03:00
lastUpdated: 2021-04-13T21:10:59+03:00
---
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
```