I was intrigued by Josh Stone's analysis of sha1 abbreviation collisions.
Let's say somebody wrote down an abbreviated commit id, 8b82547e33
, at a time when it was unambiguous. But since then other objects have been created with that same prefix, so that now git tells you (twice, for some reason):
$ git show 8b82547e33
error: short SHA1 8b82547e33 is ambiguous.
error: short SHA1 8b82547e33 is ambiguous.
fatal: ambiguous argument '8b82547e33': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Now, as a human, I could probably tell which object I meant if git would just show me the ambiguous objects. How can I achieve something like the following?
$ git objects-starting-with 8b82547e33
8b82547e33e: commit: l2tp: Restore socket refcount when sendmsg succeeds
8b82547e338: tree [2 files, 26 subtrees]
(Note: the above examples are using a relatively current clone of http://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git.)
question from:
https://stackoverflow.com/questions/27428441/how-to-disambiguate-an-ambiguous-abbreviated-sha1-in-git 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…