I want to access sha key for any repository' files individually.
As you can see. There are a file structure and that is include a .git directory which I created with gitpython. I can get repository sha key for represent all files as follow;
from git import Repo
repo = Repo("graph/features")
master = repo.head.reference
print(master.commit.hexsha)
My question is that I want to generate sha key for any file such as file2.txt. Are there any method to realize that. I am sorry, I am new about using gitPython.
Read files then
>>> import hashlib
>>> file_text = 'content'
>>> hashlib.sha256(file_text.encode()).hexdigest()
'ed7002b439e9ac845f22357d822bac1444730fbdb6016d3ec9432297b9ec9f73'
>>>