Why git can’t do hard/soft resets by path?

Because there’s no point (other commands provide that functionality already), and it reduces the potential for doing the wrong thing by accident. A “hard reset” for a path is just done with git checkout HEAD — <path> (checking out the existing version of the file). A soft reset for a path doesn’t make sense. A … Read more

git reset vs git reset HEAD

No difference (from git reset man page) in term of default parameter: The <tree-ish>/<commit> defaults to HEAD in all forms. That message initially did not include HEAD: commit 3c1eb9c, Jan. 2007, git 1.5.0-rc1, but since the default is not always known, the help message makes it clear to which commit you are supposed to reset. … Read more

What is the `git restore` command and what is the difference between `git restore` and `git reset`?

I have presented git restore (which is still marked as “experimental”) in “How to reset all files from working directory but not from staging area?”, with the recent Git 2.23 (August 2019). It helps separate git checkout into two commands: one for files (git restore), which can cover git reset cases. one for branches (git … Read more