When one tries to perform git reset --hard
with a path specfied, Git does not allow that. In such case user is presented with fatal: Cannot do hard reset with paths.
Why is that?
Granted, one can perform git checkout HEAD -- [path]
which does exactly what I would expect git reset --hard [path]
to do, but why is it not allowed? Is there any problem with running that due to how things are represented internally? Or is this just a matter of choice by git dev team?
I think this is one of those quirks that make git cli not as clean as it should be and I would really like to know why is that (why not even a message to try checkout instead?). Perhaps my line of thought where git reset --hard [path]
would equal to git checkout HEAD -- [path]
is erroneous?