def get_commits_modified_file ( self , filepath : str ) -> List [ str ] : path = str ( Path ( filepath ) ) commits = [ ] try : commits = self . git . log ( "--follow" , "--format=%H" , path ) . split ( '\n' ) except GitCommandError : logger . debug ( "Could not find information of file %s" , path ) return commits
get files changed using commitid using gitpython
Given a filepath returns all the commits that modified this file ( following renames ) .
def get_commits_modified_file(self, filepath: str) -> List[str]:
        """
        Given a filepath, returns all the commits that modified this file
        (following renames).

        :param str filepath: path to the file
        :return: the list of commits' hash
        """
        path = str(Path(filepath))

        commits = []
        try:
            commits = self.git.log("--follow", "--format=%H", path).split('\n')
        except GitCommandError:
            logger.debug("Could not find information of file %s", path)

        return commits