Git Product home page Git Product logo

Comments (2)

bk2204 avatar bk2204 commented on September 21, 2024

Hey,

I'm not sure of a good way to go about doing this in an efficient way. You probably want to use git rev-list A..B --not --remotes=dest (where dest is the destination remote), which will make this a lot more efficient and avoid traversing all objects that are already on the destination, but it's still not going to be screamingly performant.

We internally use git cat-file --batch to make it more efficient to find the objects without spawning a large number of Git processes, which you can do, too. You can also use git cat-file --batch-check first to find those items which are pointer files (which must be less than 1024 bytes), since sometimes people mark a file as an LFS file and then push the large object anyway. However, this will likely require more work than a simple shell one-liner, so you might want to write something like a Ruby script to handle this.

I think what you want here for scripting is an equivalent to git lfs push's --object-id flag, which unfortunately doesn't exist yet. It shouldn't be too hard to add if you're interested, but it's ultimately going to be rather difficult to handle as part of scripting without adding that functionality.

from git-lfs.

richard-fine avatar richard-fine commented on September 21, 2024

Yeah, I ended up solving this using a Python script which did something along the lines of my original post, except that rather than passing revisions to git lfs fetch, it was easier to directly pipe LFS pointer file content to git lfs smudge (discarding the output, but taking advantage of the fact that it caused the object to be downloaded).

And yes, supporting --object-id for git lfs fetch would be nice and would avoid needing to do the smudge shenanigans. Ideally LFS would expose facilities for synchronizing remote/local LFS object stores without needing to touch commits - push --object-id is half of that story, but we're missing a corresponding fetch piece.

from git-lfs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.