yao yao - 1 year ago 112
Git Question

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

$ git reset -- <file_path>
can reset by path.

$ git reset (--hard|--soft) <file_path>
will report an error like below:

Cannot do hard|soft reset with paths.

Answer Source

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>.

A soft reset for a path doesn't make sense.

A mixed reset for a path is what git reset -- <path> does.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download