How to run set-branches · gitpython-developers/GitPython · Discussion #1386
what will be the equivalent of git remote set-branches origin --add master8 in GitPython?
Is it repo.git.remote('set-branches', 'origin', '--add', 'master4')
yes (except for the discrepancy between master4 and master8 above), but as I understand things this is only needed after a shallow clone (using --depth).
This code snippet shows a way to make all branches available locally:
import git
repo = git.Repo('/tmp/g2')
repo.git.remote('set-branches','origin','*')
repo.git.fetch()
branchlist = [i.strip() for i in repo.git.branch('-r').split('\n') if '->' not in i]
0 replies