GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — How to run set-branches · gitpython-developers/GitPython · Discussion #1386

How to run set-branches #1386

Unanswered
dsharma522 asked this question in Q&A
How to run set-branches #1386
@dsharma522 dsharma522
Dec 20, 2021 · 1 comment
Return to top
Discussion options
  • Uh oh!

    There was an error while loading. Please reload this page.

  • Uh oh!

    There was an error while loading. Please reload this page.

dsharma522
Dec 20, 2021

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')

You must be logged in to vote
All reactions

Replies: 1 comment

Comment options
  • Uh oh!

    There was an error while loading. Please reload this page.

briantoby
Jun 22, 2024

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]
You must be logged in to vote
All reactions
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
2 participants
@dsharma522 @briantoby
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.