1

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?

theadam
  • 3,961
  • 4
  • 25
  • 41
  • 1
    Ah yeah, quick Google didn't return that result. While the answers there do not really satisfy my curiousity I assume it is just the way it is. Somebody over at the Git dev team thought it would be safer or less confusing. Of course it is neither ;) Closing the question. – theadam Feb 24 '15 at 21:39

0 Answers0