I want to get SHA256
of all versions of a file in a git repos.
(In this case there is binary blobs in a repo, and want to find from which commit in a different repo they came from)
We can use git show $hash:$file | sha256sum
to get this for one commit.
Bash example that I want to avoid:
for h in $(git log --pretty=format:"%H" -- $file)
do
git show $h:$file | sha256sum
done
Is there any way to do this for all commits with "git only"? (avoid running from bash)
Preferably inside git log
formatting to get more data.
Clarification:
Running bash "inside git" is fine, but I would like to avoid to have to run the command from bash so that is usable in both bash and powershell.
I can also not think that my hack is the best way to get checksums of each version of file in a git repo.
There has been recommendations of looking at this recent question it uses internal sha1
and has answers with bash.