有一份代码,git日志全丢失了,还有一份官方的git代码库,怎么知道这一份代码是什么时候的呢?
在旧代码,选择一个文件,计算其blob hash
$ git hash-object config-3.3
506e8f294d08c663a07022152611fcdcc27f6f9f
在git仓库,使用describe查看包含这个blob的commit
$ git describe --always 506e8f294d08c663a07022152611fcdcc27f6f9f
2d40590a23:target/linux/brcm47xx/config-3.3
没有--always,只会跟踪tags。
https://stackoverflow.com/questions/223678/which-commit-has-this-blob