我有一个repo,其中有两个分支:master和master_one。我在master分支中有一个提交(commit1(,但在master_one中不存在。现在,我又从master_one创建了一个分支"temp"。我想使用PyGithub将commit1中的更改合并到我的分支temp中。如果我使用以下代码从master创建分支,我可以合并它:
repo.merge(branch_name,commit_sha_key,"merge to master")
其中CCD_ 1是commit1的sha。
但对于我从master_one创建的临时分支,我不能做同样的事情。
有什么办法吗?感谢
GitHub api不支持Cherry pick,因此您必须从命令行执行:
# ~~~ snip initialize git repo locally, maybe using git clone ~~~
import os
os.system(f"git cherry-pick {commit_sha_key}")
os.system("git push") # you may need to do "git push origin temp"
# ~~~ snip ~~~ cleanup, if you want.