Skip to content

Fetch from a URL directly #558

Closed as not planned
Closed as not planned

Description

@jamielennox

Something I've come across a few times trying to deal with automating multiple repositories is that the only way to fetch is with a defined remote. I want to be able to do the equivalent of git fetch git://repo.url/path/repo.git branch/name and have it return a FetchInfo I can use. Currently i'm working around this by creating a new remote, fetching from it and deleting it at the end of the operation.

Thanks.

Activity

  1. Byron commented on Dec 12, 2016

    @Byron
    Member

    Thanks for your feedback!

    From this ticket I can only assume what you would like to see. If you flesh it out to become a feature request, chances are that someone will pick it up and implements some additional API to make that easier.

    In the meanwhile, a valid workaround would be to call git directly:

    r = git.Repo('path/to/clone')
    r.git.fetch('git://repo.url/path/repo.git', 'branch/name')
  2. jamielennox commented on Dec 12, 2016

    @jamielennox
    Author

    So i don't really mind what the API is, I was hoping to request the feature and then leave it up to the developers. I think the most likely is the same/similar interface (and probably code) as remote.fetch but directly on the repo. ie:

    r = git.Repo('path/to/clone')`
    fetch_info = r.fetch('git://repo.url/path/repo.git', 'branch/name')
    print fetch_info.ref
    

    You're right, I can use r.git.fetch and i guess FETCH_HEAD is then valid there but i thought i'd put it up as a feature request as it's something i've come across more than once now.

  3. Byron commented on Dec 12, 2016

    @Byron
    Member

    As GitPython is in maintenance mode, new features will have to be contributed.
    Maybe someone is attracted by the help wanted label as well.

  4. added theissue type on Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions