15

I am looking for a equivalent way to fetch in gitpython

git fetch --quiet --all

How can I perform git fetch in python?

devops
  • 1,121
  • 5
  • 20
  • 50

1 Answers1

32

The fetch method is equivalent to issuing git fetch. Accordingly, you can fetch all your remotes by iterating and fetching each individually:

repo = git.Repo('name_of_repo')
for remote in repo.remotes:
    remote.fetch()
zeantsoi
  • 25,857
  • 7
  • 69
  • 61