使用gitpython创建并将空分支推送到git

时间:2018-09-21 09:50:31

标签: python git gitpython

我正在尝试创建一个空分支,并使用gitpython将其推送到git。

new_branch = "branch1"
commit_msg = "root commit"
repo.git.checkout("--orphan", new_branch)
repo.git.rm("-f *")
repo.git.commit("--allow-empty", message=commit_msg)
repo.git.push("origin", new_branch)
print("done")

它在repo.git.rm("-f *")失败,错误为stderr: 'error: unknown switch' 如何通过gitpython使用git rm -f *

0 个答案:

没有答案