Is there a way to get SHA of file for specific Git commit?
It's possible with 2 commands:
git show COMMIT_VERSION:myfile.txt > ~/tmp/myfile.txt
git hash-object ./tmp/myfile.txt
But, maybe there's specific command in Git that does exactly that?
"SHA" stands for Simple Hashing Algorithm. The checksum is the result of combining all the changes in the commit and feeding them to an algorithm that generates these 40-character strings. A checksum uniquely identifies a commit.
git ls-tree COMMIT_VERSION myfile.txt
appears to contain the same result in its third field.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With