Add discard snippets

This commit is contained in:
Isabelle Viktoria Maciohsek
2021-04-06 11:11:08 +03:00
parent d540ba1e48
commit c191f90c77
2 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1,17 @@
---
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.
```sh
git reset --hard HEAD
```
```sh
git reset --hard HEAD
# Discards all unstaged changes
```

View File

@ -0,0 +1,17 @@
---
title: Discard untracked changes
tags: branch,intermediate
---
Discards all untracked changes to the current branch.
- Use `git clean -f -d` to discard all untracked changes to the current branch.
```sh
git clean -f -d
```
```sh
git clean -f -d
# Discards all untracked changes
```