Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法为特定的 Git 提交获取文件的 SHA?
可以使用 2 个命令:
git show COMMIT_VERSION:myfile.txt > ~/tmp/myfile.txt
git hash-object ./tmp/myfile.txt
但是,也许 Git 中有特定的命令可以做到这一点?
git ls-tree COMMIT_VERSION myfile.txt似乎在其第三个字段中包含相同的结果。
git ls-tree COMMIT_VERSION myfile.txt