Files
30-seconds-of-code/git/s/discard-uncommitted.md
Angelos Chalaris 5c913d20bd Reorganize snippets
2023-05-03 21:19:02 +03:00

22 lines
422 B
Markdown

---
title: Discard uncommitted changes
type: snippet
language: git
tags: [branch]
cover: arrays
dateModified: 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
```