简体   繁体   中英

How to get SHA of file for specific Git commit?

Is there a way to get SHA of file for specific Git commit?

It's possible with 2 commands:

  1. retrieving file git show COMMIT_VERSION:myfile.txt > ~/tmp/myfile.txt
  2. calculating SHA git hash-object ./tmp/myfile.txt

But, maybe there's specific command in Git that does exactly that?

git ls-tree COMMIT_VERSION myfile.txt在其第三个字段中似乎包含相同的结果。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM