概述
我在Python中使用此代码(使用“import git”):
repo = git.Repo("my_repository")
repo.git.add("bla.txt")
repo.git.commit("my commit description")
现在我想推动这个提交.我已经尝试了很多但没有成功. Python命令应该与此Bash命令类似:
git push origin HEAD:refs/for/master
repo.git.pull('origin',new_branch)
repo.git.push('origin',new_branch)
总结
以上是编程之家为你收集整理的Git通过GitPython推送全部内容,希望文章能够帮你解决Git通过GitPython推送所遇到的程序开发问题。
如果您也喜欢它,动动您的小指点个赞吧