From ca02eda70408d8c256678bfd759aee5bdd4b1307 Mon Sep 17 00:00:00 2001 From: Orest Ivasiv Date: Sat, 7 Oct 2023 21:22:03 +0200 Subject: [PATCH] Added git.md --- docs/wiki/howtos/git.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 docs/wiki/howtos/git.md diff --git a/docs/wiki/howtos/git.md b/docs/wiki/howtos/git.md new file mode 100644 index 0000000..cd5fc0c --- /dev/null +++ b/docs/wiki/howtos/git.md @@ -0,0 +1,29 @@ +--- +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 + +The `--soft` option means that you will not lose the uncommitted changes you may have. + +```shell +git reset --soft HEAD~1 +``` + +### hard reset + +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 +``` +