def METHOD_NAME(
    repo_dir: str, templates: list[BaseTemplate], details: list[TemplateChangeDetails]
):
    repo = Repo(repo_dir)
    # intended to delete
    deleted_template_path_to_template: dict[str, BaseTemplate] = {
        template.file_path: template for template in templates if template.deleted
    }
    for template_detail in details:
        if template_detail.template_path in deleted_template_path_to_template:
            if template_detail.exceptions_seen:
                log_params = {"path": template_detail.template_path}
                log.error(
                    "add_commits_from_delete_templates cannot be deleted due to exceptions in apply",
                    **log_params,
                )
            else:
                deleted_template_path_to_template[
                    template_detail.template_path
                ].delete()
    diff_list = repo.head.commit.diff()
    if len(diff_list) > 0:
        repo.git.commit("-m", "Delete template after successfully delete resources")