我正在尝试创建来自python的拉取请求,它似乎不适用于gitpython。签出、创建分支、提交和推送工作正常,但是拉取请求似乎不起作用。经过一些快速搜索后,我发现hub是创建拉取请求的cli。是否有python API用于创建拉流请求。到目前为止,这是我的代码。
from git import Repo
import git
Repo.clone_from(url='git@github.com:Amjad/test_repo.git', to_path='./test_repo')
git_branch = "test7"
git_repo = Repo("./test_repo")
git_repo.git.checkout("-b", git_branch)
git_repo.git.status()
shutil.copy("./ps.txt", "./test_repo/ps.txt")
git_repo.git.add("ps.txt")
git_repo.git.commit(m="first test push")
git_repo.git.push('--set-upstream', 'origin', git_branch)
git_repo.git.request_pull(git_branch, 'git@github.com:Amjad/test_repo.git', "master")发布于 2020-01-07 22:35:06
拉取请求以每个服务为单位。这意味着你不需要从通用的git库中创建一个命令,但是你可以使用任何远程API (REST http等)来创建它们。创建拉取请求。
例如,使用GitHub,您可以make pull requests with the REST API.
https://stackoverflow.com/questions/59623518
复制相似问题