Get all the commits message of a file using GitPython

42 views Asked by At

I have the following piece of code to get the list of commit summaries of a specific file:

from git import Repo
repo_working_dir = '<valid directory of the repo>'

repo = Repo(repo_working_dir)

update_file = '<full path of the file whose commit summaries I want to read>'
for commit in list(repo.iter_commits(repo.active_branch,paths=update_file)):
    print(commit.summary)

The above code runs but returns no output. Please let me know where I am going wrong.

0

There are 0 answers