What command did git do with "git reset --har"
This is as per the gitcli
doc page:
many commands allow a long option "--option" to be abbreviated only to their unique prefix (e.g. if there is no other option whose name begins with "opt", you may be able to spell "--opt" to invoke the "--option" flag), but you should fully spell them out when writing your scripts; later versions of Git may introduce a new option whose name shares the same prefix, e.g. "--optimize", to make a short prefix that used to be unique no longer unique.
Also on the same page:
Commands that support the enhanced option parser accepts unique prefix of a long option as if it is fully spelled out, but use this with a caution. For example, git commit --amen behaves as if you typed git commit --amend, but that is true only until a later version of Git introduces another option that shares the same prefix, e.g `git commit --amenity" option.
So yeah, it ran git reset --hard
It did not run the equivalent of -h -a -r
because there are two preceding dashes, not one.
Git may be implementing an algorithm here to allow you to use the shortest unique match for a long flag name. Since no long flags for git reset
start with --har
, it could have then treated the request as unambiguous and proceeded to run git reset --hard
.