您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

Git通过GitPython推送

5b51 2022/1/14 8:21:49 python 字数 902 阅读 515 来源 www.jb51.cc/python

我在Python中使用此代码(使用“import git”):repo = git.Repo('my_repository') repo.git.add('bla.txt') repo.git.commit('my commit description') 现在我想推动这个提交.我已经尝试了很多但没有成功. Python命令应该与此Bash命令类似:git

概述

我在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推送所遇到的程序开发问题。


如果您也喜欢它,动动您的小指点个赞吧

除非注明,文章均由 laddyq.com 整理发布,欢迎转载。

转载请注明:
链接:http://laddyq.com
来源:laddyq.com
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。


联系我
置顶