git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Can you git clone -partial? I am looking to make a mobile app and it would be nice to have.

From
JHJames Hancock <james@bookstobrains.com>
Date
Oct 1, 2014, 21:32 UTC
Message-ID
<CAOHoyPq7dxAgw+O7A8d1v36a3BJrW8cEZM79YwY_4cQd80Mawg@mail.gmail.com>
In-Reply-To
<xmqqtx3npu6e.fsf@gitster.dls.corp.google.com>

I see what you are saying with the file thing. I am not a git master and I am afraid that is showing in the words I use...

The app I want to build is actually part of testing a Mobile Markdown Editor I am working on. I thought a good way to prove the system would be to make a simple app that allows you to edit your READMEs and other Markdown pages in your projects that use Git. They could be hosted on Github or elsewhere. It is mostly about testing the editor functionality on a larger scale.

So, I want to just get the files I need out of the collection of file history and then put it back when and if I need to. But, I want to do this with as little network and data storage as possible (given the limitations of a mobile environment). I know most projects aren't very large as far as file size goes, but I am still wondering at what it would take to do this and if Git has the ability, or what would need to change for it to have the ability. Maybe it isn't worth it? I just want to be able to say why it isn't worth it with good reason.

I read about git archive and I looks like it almost does what I want. I am not sure what happens underlying so my Git Noobness will show again here. I found documentation on how to us archive but I haven't been able to find something that tells me how archive does what it does.

1) Can you the push your changes in a file that you have used git
archive for? Maybe you can do it just to set up a pull request or
something.
2) How would the archive know when to pull updated changes? My
understanding is that archive would just pull out the file but it
would then be separated from its' parent. Is there a cost effective
way to compare the archive to the master without downloading the whole
history? Maybe I could keep a record of where the repo is and just
have the program check the original repo for a new version?
3) I am wondering how intensive archive is? Do you need to get
everything and then it narrow it down on your end or do you just grab
the small part you need? How does the repo know what to give you? It
says it compresses the data. Where does the compression happen?

Cheers, James

On Thu, Oct 2, 2014 at 1:38 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 28 quoted lines
> James Hancock <james@bookstobrains.com> writes:
>
>> i am thinking about developing an app and I want to integrate it with
>> git but I only want to store a portion of the file on disk. It is
>> going to be in a mobile enviornment and I want to just get one file or
>> a small group of files.
>>
>> I read that you can clone and then only look at one peice but is it
>> possible just to clone one peice? And if not what would it take? Maybe
>> this is a feature people would like to have. Just hypothetically, what
>> would need to happen?
>>
>> Either
>> git clonepartial /repo /file/or/folder/in/repo
>> Or
>> Git clone -partial /repo /file/or/folder/in/repo
>
> You keep saying "file", but the thing is, Git does not track file.
> It tracks history of collection of files.
>
> What are you trying to achieve, exactly?  What does your "app" need
> out of that operation?  Does it need these selected files with their
> history?  Or does it only care about the contents of the selected
> files at the tip of the 'master' branch of that repository?
>
> I'd imagine that your answer would be the latter, and suspect that
> you may want to run "git archive --remote" with a pathspec to limit
> what gets grabbed.
Previous: Junio C Hamano
Message 3 of 3 in “Can you git clone -partial? I am looking to make a mobile app and it would be nice to have.”
  1. James HancockOct 1, 2014
  2. Junio C HamanoOct 1, 2014
  3. James HancockOct 1, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.