In the git checkout example, I tried to type git checkout bb92 to check out the commit labeled “bb92e0e…” on the graph. I got the error “Cannot find commit: bb92”. I had to type the full 7-character name to perform the checkout command.
Abbreviated commits hashes should work, to save the user typing when exploring Git. The command line should only display an error if the hash is ambiguous, like “Ambiguous abbreviated ref: e”, or if no commit begins with that prefix, like “No such ref: 123”.
In the
git checkout
example, I tried to typegit checkout bb92
to check out the commit labeled “bb92e0e…” on the graph. I got the error “Cannot find commit: bb92”. I had to type the full 7-character name to perform thecheckout
command.Abbreviated commits hashes should work, to save the user typing when exploring Git. The command line should only display an error if the hash is ambiguous, like “Ambiguous abbreviated ref: e”, or if no commit begins with that prefix, like “No such ref: 123”.
The code that identifies a ref given its name is
getCommit
inhistoryview.js
.