Переименуйте имя ветки git на удаленном компьютере, используя PyGithub

Как я могу переименовать удаленную ветку GitHub с помощью PyGithub Python API?

0 ответов

Ссылка от официального PyGithub - https://github.com/PyGithub/PyGithub https://pygithub.readthedocs.io/en/latest/apis.html

from github import Github

# using username and password
g = Github("user", "password")

# or using an access token
g = Github("access_token")

# Git reference of the branch that you wish to delete
src = g.get_git_ref("heads/source branch name")

# Create new branch from old branch
g.create_git_ref("refs/heads/new branch name", sha=src.object.sha)

# Delete old branch reference
src.delete()
Другие вопросы по тегам