Top "Git-reset" questions

Sets the current Git repo head to a specified commit and optionally resets the index and working tree to match.

Reset all changes after last commit in git

How can I undo every change made to my directory after the last commit, including deleting added files, resetting modified …

git git-commit git-reset git-revert
How to git reset --hard a subdirectory?

UPDATE²: With Git 2.23 (August 2019), there's a new command git restore that does this, see the accepted answer. UPDATE: This will …

git reset git-reset sparse-checkout
Unstaged changes left after git reset --hard

After git reset --hard, git status gives me files within the Changes not staged for commit: section. I've also tried …

git git-reset
What's the difference between "git reset" and "git checkout"?

I've always thought of git reset and git checkout as the same, in the sense that both bring the project …

git git-checkout git-reset
What's the difference between Git Revert, Checkout and Reset?

I am trying to learn how to restore or rollback files and projects to a prior state, and don't understand …

git git-checkout git-reset git-revert
git rm --cached file vs git reset file

I'm trying to learn Git. I'm confused between git rm --cached file and git reset file both of the commands …

git git-reset git-rm
Why git can't do hard/soft resets by path?

$ git reset -- <file_path> can reset by path. However, $ git reset (--hard|--soft) <file_path> …

git git-reset
Undo “git add <dir>”?

I mistakenly added files using the command "git add dir". I have not yet run "git commit". Is there a …

git git-reset
Undo git reset --hard with uncommitted files in the staging area

I am trying to recover my work. I stupidly did git reset --hard, but before that I've done only get …

git undo git-commit git-reset git-add
What is the `git restore` command and what is the difference between `git restore` and `git reset`?

When I want to unstage a staged file, all of my Git tutorials show something like: $ git add * $ git status …

git restore git-reset unstage