Why git can't do hard/soft resets by path?
git, git-reset
Solution
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 mixed reset for a path is what `git reset -- <path>` does.
Problem
`$ git reset -- <file_path>` can reset by path. However, `$ git reset (--hard|--soft) <file_path>` will report an error like below: ``` Cannot do hard|soft reset with paths. ```
Related problems
- How to git reset --hard a subdirectory
- How to get just one file from another branch
- Using git, how do you reset the working tree (local file system state) to the state of the index ("staged" files)?
- What's the difference between HEAD, working tree and index, in Git?
- Hard reset of a single file
- How do I remove local (untracked) files from the current Git working tree?
- Git copy file from another branch without staging it
- How do I discard unstaged changes in Git?