这是我所学到的,
g = Github("user", "pass")
repoName = "apiTest"
print "Get all repos:"
for repo in g.get_user().get_repos():
print "\t%s" % repo.name
print "<--------------------------------------------------->"
print "Get all branches in repo %s:" % repoName
for branch in g.get_user().get_repo(repoName).get_branches():
print "\t%s" % branch.name
print "<--------------------------------------------------->"
print "Get last commit message in repo %s:" % repoName
branch = g.get_user().get_repo(repoName).get_branch("dev")
lastCommit = branch._commit.value.commit
print "\t%s" % lastCommit._message.value
print "\t%s"
print "<--------------------------------------------------->"
fc = repo.update_file("/README.md", "testing PyGithub", "test commit", fc.sha)
print fc
但我想知道如何结帐到新分行。我没有在网上找到任何例子。非常感谢你。
答案 0 :(得分:4)
您可以使用PyGithub create_git_ref函数创建新分支。使用上面的例子:
app