def read_git_commit_timestamp_for_file(filepath, repo_path=None, repo=None):
logger = logging.getLogger(__name__)<EOL>if repo is None:<EOL><INDENT>repo = git.repo.base.Repo(path=repo_path,<EOL>search_parent_directories=True)<EOL><DEDENT>repo_path = repo.working_tree_dir<EOL>head_commit = repo.head.commit<EOL>logger.debug('<STR_LIT>', repo_path)<EOL>filepath = os.path.relpath(<EOL>os.path.abspath(filepath),<EOL>start=repo_path)<EOL>logger.debug('<STR_LIT>', filepath)<EOL>for commit in head_commit.iter_items(repo,<EOL>head_commit,<EOL>[filepath],<EOL>skip=<NUM_LIT:0>):<EOL><INDENT>return commit.committed_datetime<EOL><DEDENT>raise IOError('<STR_LIT>'.format(filepath))<EOL>
Obtain the timestamp for the most recent commit to a given file in a
    Git repository.

    Parameters
    ----------
    filepath : `str`
        Absolute or repository-relative path for a file.
    repo_path : `str`, optional
        Path to the Git repository. Leave as `None` to use the current working
        directory or if a ``repo`` argument is provided.
    repo : `git.Repo`, optional
        A `git.Repo` instance.

    Returns
    -------
    commit_timestamp : `datetime.datetime`
        The datetime of the most recent commit to the given file.

    Raises
    ------
    IOError
        Raised if the ``filepath`` does not exist in the Git repository.