{"thread":{"id":"37660","subject":"Can you git clone -partial? I am looking to make a mobile app and it would be nice to have.","startedAt":"2014-10-01T16:51:58Z","lastAt":"2014-10-01T21:32:20Z","messageCount":3,"participants":["James Hancock","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"250123","messageId":"CAOHoyPr3E9U3XPEjmrSNkT0okHcRN2H7OKyrt-Ar3WMMDL=4vw@mail.gmail.com","threadId":"37660","inReplyTo":null,"subject":"Can you git clone -partial? I am looking to make a mobile app and it would be nice to have.","fromName":"James Hancock","fromEmail":"james@bookstobrains.com","sentAt":"2014-10-01T16:51:58Z","receivedAt":"2014-10-01T16:51:58Z","isPatch":false,"sender":{"key":"james@bookstobrains.com","avatar":null},"body":"i am thinking about developing an app and I want to integrate it with\ngit but I only want to store a portion of the file on disk. It is\ngoing to be in a mobile enviornment and I want to just get one file or\na small group of files.\n\nI read that you can clone and then only look at one peice but is it\npossible just to clone one peice? And if not what would it take? Maybe\nthis is a feature people would like to have. Just hypothetically, what\nwould need to happen?\n\nEither\ngit clonepartial /repo /file/or/folder/in/repo\nOr\nGit clone -partial /repo /file/or/folder/in/repo\n\nI guess you would need to keep the projects .git in order to maintain\nconsistency, or would you? I'm going to do some more research about\nwhat .git does exactly.\n\nCheers,\nJames\n"},{"id":"250125","messageId":"xmqqtx3npu6e.fsf@gitster.dls.corp.google.com","threadId":"37660","inReplyTo":"CAOHoyPr3E9U3XPEjmrSNkT0okHcRN2H7OKyrt-Ar3WMMDL=4vw@mail.gmail.com","subject":"Re: Can you git clone -partial? I am looking to make a mobile app and it would be nice to have.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-10-01T17:38:01Z","receivedAt":"2014-10-01T17:38:01Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"James Hancock <james@bookstobrains.com> writes:\n\n> i am thinking about developing an app and I want to integrate it with\n> git but I only want to store a portion of the file on disk. It is\n> going to be in a mobile enviornment and I want to just get one file or\n> a small group of files.\n>\n> I read that you can clone and then only look at one peice but is it\n> possible just to clone one peice? And if not what would it take? Maybe\n> this is a feature people would like to have. Just hypothetically, what\n> would need to happen?\n>\n> Either\n> git clonepartial /repo /file/or/folder/in/repo\n> Or\n> Git clone -partial /repo /file/or/folder/in/repo\n\nYou keep saying \"file\", but the thing is, Git does not track file.\nIt tracks history of collection of files.\n\nWhat are you trying to achieve, exactly?  What does your \"app\" need\nout of that operation?  Does it need these selected files with their\nhistory?  Or does it only care about the contents of the selected\nfiles at the tip of the 'master' branch of that repository?\n\nI'd imagine that your answer would be the latter, and suspect that\nyou may want to run \"git archive --remote\" with a pathspec to limit\nwhat gets grabbed.\n"},{"id":"250131","messageId":"CAOHoyPq7dxAgw+O7A8d1v36a3BJrW8cEZM79YwY_4cQd80Mawg@mail.gmail.com","threadId":"37660","inReplyTo":"xmqqtx3npu6e.fsf@gitster.dls.corp.google.com","subject":"Re: Can you git clone -partial? I am looking to make a mobile app and it would be nice to have.","fromName":"James Hancock","fromEmail":"james@bookstobrains.com","sentAt":"2014-10-01T21:32:20Z","receivedAt":"2014-10-01T21:32:20Z","isPatch":false,"sender":{"key":"james@bookstobrains.com","avatar":null},"body":"I see what you are saying with the file thing. I am not a git master\nand I am afraid that is showing in the words I use...\n\nThe app I want to build is actually part of testing a Mobile Markdown\nEditor I am working on. I thought a good way to prove the system would\nbe to make a simple app that allows you to edit your READMEs and other\nMarkdown pages in your projects that use Git. They could be hosted on\nGithub or elsewhere. It is mostly about testing the editor\nfunctionality on a larger scale.\n\nSo, I want to just get the files I need out of the collection of file\nhistory and then put it back when and if I need to. But, I want to do\nthis with as little network and data storage as possible (given the\nlimitations of a mobile environment). I know most projects aren't very\nlarge as far as file size goes, but I am still wondering at what it\nwould take to do this and if Git has the ability, or what would need\nto change for it to have the ability. Maybe it isn't worth it? I just\nwant to be able to say why it isn't worth it with good reason.\n\nI read about git archive and I looks like it almost does what I want.\nI am not sure what happens underlying so my Git Noobness will show\nagain here. I found documentation on how to us archive but I haven't\nbeen able to find something that tells me how archive does what it\ndoes.\n\n1) Can you the push your changes in a file that you have used git\narchive for? Maybe you can do it just to set up a pull request or\nsomething.\n\n2) How would the archive know when to pull updated changes? My\nunderstanding is that archive would just pull out the file but it\nwould then be separated from its' parent. Is there a cost effective\nway to compare the archive to the master without downloading the whole\nhistory? Maybe I could keep a record of where the repo is and just\nhave the program check the original repo for a new version?\n\n3) I am wondering how intensive archive is? Do you need to get\neverything and then it narrow it down on your end or do you just grab\nthe small part you need? How does the repo know what to give you? It\nsays it compresses the data. Where does the compression happen?\n\n\nCheers,\nJames\n\nOn Thu, Oct 2, 2014 at 1:38 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> James Hancock <james@bookstobrains.com> writes:\n>\n>> i am thinking about developing an app and I want to integrate it with\n>> git but I only want to store a portion of the file on disk. It is\n>> going to be in a mobile enviornment and I want to just get one file or\n>> a small group of files.\n>>\n>> I read that you can clone and then only look at one peice but is it\n>> possible just to clone one peice? And if not what would it take? Maybe\n>> this is a feature people would like to have. Just hypothetically, what\n>> would need to happen?\n>>\n>> Either\n>> git clonepartial /repo /file/or/folder/in/repo\n>> Or\n>> Git clone -partial /repo /file/or/folder/in/repo\n>\n> You keep saying \"file\", but the thing is, Git does not track file.\n> It tracks history of collection of files.\n>\n> What are you trying to achieve, exactly?  What does your \"app\" need\n> out of that operation?  Does it need these selected files with their\n> history?  Or does it only care about the contents of the selected\n> files at the tip of the 'master' branch of that repository?\n>\n> I'd imagine that your answer would be the latter, and suspect that\n> you may want to run \"git archive --remote\" with a pathspec to limit\n> what gets grabbed.\n"}]}