-
-
Notifications
You must be signed in to change notification settings - Fork 954
How to run set-branches #1386
Unanswered
dsharma522
asked this question in
Q&A
How to run set-branches
#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')
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment
-
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]
Beta Was this translation helpful? Give feedback.
All reactions
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment