Skip to content

Commit

Permalink
upd git.md
Browse files Browse the repository at this point in the history
  • Loading branch information
halyph committed Oct 13, 2023
1 parent 47afc28 commit 1723799
Showing 1 changed file with 2 additions and 21 deletions.
23 changes: 2 additions & 21 deletions docs/wiki/howtos/git.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,13 @@ tags:
- git
---

[git-reset]: https://www.freecodecamp.org/news/git-revert-commit-how-to-undo-the-last-commit/ "Git Revert Commit – How to Undo the Last Commit"

# git

## Undo the Last Commit

[Source][git-reset]

### soft reset

??? note

The `--soft` option means that you will not lose the uncommitted changes you may have.

```shell
git reset --soft HEAD~1
```

### hard reset

??? note

If you want to reset to the last commit and also remove all unstaged changes, you can use the `--hard` option

```shell
git reset --hard HEAD~1
git reset --soft HEAD~1 # you won't lose the uncommitted changes you may have
git reset --hard HEAD~1 # also remove all unstaged changes
```

## Deleting a remote branch
Expand Down

0 comments on commit 1723799

Please sign in to comment.