如何将 git 的结果保存为 excel 文件

How to save the results of git show as an excel file

我想使用 python

保存特定版本的 excel 文件

我已经用git show得到了这个excel

的内容

git show 17ed4f74:xxx.xlsx

输出:

如何将其保存为 .xlsx 文件

output = repo.git.execute(["git", "show", flag + ":" + git_path], None, False, True, False, None, False)
with open(remote_file_path, 'wb') as f:
    f.write(output)

git.execute第七个参数:

stdout_as_string – 如果为 False,命令标准输出将是字节。否则,它将使用默认编码(通常为 utf-8)解码为字符串。如果输出包含二进制数据,后者可能会失败。