0

我正在使用 GIT 存储库进行浅克隆和浅提取,代码中使用了 Git-Python

在 Git-python 中,以下 git cmd 命令的等效命令是什么 git remote set-branches origin --add master8

我阅读了他们的文档,但无法使其工作。任何帮助表示赞赏。

相关代码

repo = git.Repo('Demo1')
repo.remotes.origin.fetch('+refs/heads/master2:refs/remotes/origin/master2', depth=1)
'git remote set-branches origin --add  master2' # need to run this
# repo.git.remote('set-branches', 'origin', '--add', 'master2')
repo.git.checkout('master2')
repo.git.reset('--hard', f'origin/master2')
repo.git.clean('-dfx')
repo.remotes.origin.pull(depth=1)
4

0 回答 0