git: did you mean 'commit'?
· Levenshtein distance against every git command, with git's own weights/signatures/did-you-meanbuilt on Binary search> git comit
comparing 0 / 42…
"git comit" is not a command. Compare "comit" with each of the 42 commands git knows, with git's weights (swap 0, insert 1, substitute 2, delete 3).
git: did you mean 'commit'?
Edit distance counts the fewest insertions, deletions and substitutions that turn one string into another. The dynamic-programming table has one row per character typed and one column per character of the candidate; each cell is the cheapest of three neighbours plus the cost of its own edit, and the bottom-right cell is the answer.
When you mistype a subcommand, git computes this distance from what you typed to every command it knows and suggests the closest. Its weights are not all 1: a swap of two adjacent letters costs 0, an extra letter 1, a wrong letter 2 and a missing letter 3, because those are the mistakes people actually make. Toggle the weights and watch the ranking change.