I am trying to access the commit history of a single file as in:
git log --follow -- <filename>
I have to use gitpython, so what I am doing now is:
import git
g = git.Git('repo_dir')
hexshas = g.log('--pretty=%H','--follow','--',filename).split('\n')
then I build commit objects:
repo = git.Repo('repo_dir')
commits = [repo.rev_parse(c) for c in r]
Is there a way to do it in a more gitpython-ic way?
I tried both commit.iter_parents()
and commit.iter_items()
, but they both rely on git-rev-list
, so they don't have a --follow
option.
r
?repo
? – Marlborough