如何从github获取所有提交,以及它们所更改的文件。在Python中

2024-05-16 00:18:52 发布

您现在位置:Python中文网/ 问答频道 /正文

因此,我一直在使用github enterprise,并设法从存储库中获取所有commit mesagges,但问题是我无法获取它们也已更改的文件

如果我从github api使用这个:

获取/回购/:所有者/:回购/提交

我得到提交,但我没有得到项目“文件”,这表明文件已被更改

但如果我想得到一个单一的提交,它显示的“文件”已被更改等

GET/repos/:owner/:repo/commits/:ref

You ge this: (Github example)

{
  "commit": {
            .....
            .....
  "files": [
    {
      "filename": "file1.txt",
      "additions": 10,
      "deletions": 2,
      "changes": 12,
      "status": "modified",
      "raw_url": "https://github.com/octocat/Hello-World/raw/7ca483543807a51b6079e54ac4cc392bc29ae284/file1.txt",
      "blob_url": "https://github.com/octocat/Hello-World/blob/7ca483543807a51b6079e54ac4cc392bc29ae284/file1.txt",
      "patch": "@@ -29,7 +29,7 @@\n....."
    }
  ]
}

其中包含已更改的文件

So how can I do it to get all of the commits but with the files they have changed all together?


Tags: 文件httpsgithubtxtcomurlhelloworld