How to get a SHA file for a specific git commit?

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

This is possible with two commands:

  • file extraction git show COMMIT_VERSION:myfile.txt > ~/tmp/myfile.txt
  • SHA calculation git hash-object ./tmp/myfile.txt

But maybe there is a specific team in Git that does just that?

+5
source share
1 answer

git ls-tree COMMIT_VERSION myfile.txtappears to contain the same result in the third field.

+5
source

All Articles