Git 没有完整的本地副本

Git without complete local copy

假设我在 GitHub 上有一个很大的回购协议,我正在从一台计算机上推送 space。我想一个一个地推送文件,而不必将每个文件都从远程保存。如果我想从远程编辑一个文件,我会下载它,进行更改,然后再推送回远程。有什么办法吗?

我想以编程方式为 Web 服务执行此操作。

您可以使用 GitHub 的 API 来实现。

您可以检索给定路径的文件内容:

https://developer.github.com/v3/repos/contents/#get-contents

This method returns the contents of a file or directory in a repository.

GET /repos/:owner/:repo/contents/:path

Files and symlinks support a custom media type for retrieving the raw content or rendered HTML (when supported). All content types support a custom media type to ensure the content is returned in a consistent object format.

您还可以更新给定路径的内容:

https://developer.github.com/v3/repos/contents/#update-a-file

This method updates a file in a repository

PUT /repos/:owner/:repo/contents/:path

您还可以创建新文件或删除文件。

https://developer.github.com/v3/repos/contents/#create-a-file

https://developer.github.com/v3/repos/contents/#delete-a-file

API 内容广泛 - 您可以在文档中找到更多内容。