How to get the directory git detail from repo in GitPython?


April 2019


4 time


I would like to get the number of commit of a directory(called module) from a repo(project) in GitPython.

> print("before",modulePath) 
> repo = Repo(modulePath)                    
> print(len(list(repo.iter_commits())))

When I'm trying to print the directory amount of commits, It says the repo is not a valid git Repo.

  • before /home/user/project/module
  • git.exc.InvalidGitRepositoryError: /home/user/project/module

Any help or idea would be welcome :) Thanks

0 answers