{"thread":{"id":"21455","subject":"Binary files in a linear repository","startedAt":"2009-11-02T15:08:25Z","lastAt":"2009-11-02T18:37:40Z","messageCount":8,"participants":["Markus Hitter","Björn Steinbrink","Dmitry Potapov"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"126591","messageId":"8470D32E-2CAA-4E3F-8BA0-B4578372A3C4@jump-ing.de","threadId":"21455","inReplyTo":"S1754797AbZKBONX/20091102141323Z+268@vger.kernel.org","subject":"Binary files in a linear repository","fromName":"Markus Hitter","fromEmail":"mah@jump-ing.de","sentAt":"2009-11-02T15:08:25Z","receivedAt":"2009-11-02T15:08:25Z","isPatch":false,"sender":{"key":"mah@jump-ing.de","avatar":"https://avatars.githubusercontent.com/u/318581?v=4"},"body":"\nHello all,\n\ncurrently I'm planning a frontend tool which makes use of only a  \nsmall subset of git. The repo's contents is all binary (think of  \npictures). Accordingly, I can't merge in a meaningful way, making  \nbranches of very limited use.\n\nThe situation I'm trying to solve is:\n\n- A revision earlier than the latest one is checked out.\n\n- Files of this earlier commit are modified.\n\n- I want to record this earlier commit along with it's modifications  \nas a new commit on top of master, ignoring intermediate commits:\n\ncom005  <-- master\ncom004\ncom003  <-- HEAD, files modified\ncom002\ncom001 (initial commit)\n\nOne solution to do this is to move all files somewhere else, check  \nout master, deleting all checked out files, placing the moved away  \nfiles back into place and committing the result as com006. Obviously,  \nthis is a pretty complex operation, just waiting to exploit coding  \nmistakes. Additionally, this will be slow.\n\nNow I'm thinking about a much simpler solution: Simply declare the  \ncurrent set of files as (a modified) master/com005 and commit them. A  \n\"cp $GIT_DIR/master $GIT_DIR/HEAD\" followed by a commit would do it.\n\nNow my question: Is it safe to tweak the files in $GIT_DIR this way  \nor will this corrupt the repository?\n\n\nThanks for any opinions,\nMarkus\n"},{"id":"126593","messageId":"20091102153428.GA4778@atjola.homenet","threadId":"21455","inReplyTo":"8470D32E-2CAA-4E3F-8BA0-B4578372A3C4@jump-ing.de","subject":"Re: Binary files in a linear repository","fromName":"Björn Steinbrink","fromEmail":"b.steinbrink@gmx.de","sentAt":"2009-11-02T15:34:28Z","receivedAt":"2009-11-02T15:34:28Z","isPatch":false,"sender":{"key":"b.steinbrink@gmx.de","avatar":"https://avatars.githubusercontent.com/u/230962?v=4"},"body":"On 2009.11.02 16:08:25 +0100, Markus Hitter wrote:\n> The situation I'm trying to solve is:\n> \n> - A revision earlier than the latest one is checked out.\n> \n> - Files of this earlier commit are modified.\n> \n> - I want to record this earlier commit along with it's modifications\n> as a new commit on top of master, ignoring intermediate commits:\n> \n> com005  <-- master\n> com004\n> com003  <-- HEAD, files modified\n> com002\n> com001 (initial commit)\n> \n> One solution to do this is to move all files somewhere else, check\n> out master, deleting all checked out files, placing the moved away\n> files back into place and committing the result as com006.\n> Obviously, this is a pretty complex operation, just waiting to\n> exploit coding mistakes. Additionally, this will be slow.\n\nInstead of doing \"git checkout com003\", which detaches HEAD, you could\ndo:\ngit read-tree -u --reset com003\n\nWhich will update the index and working tree to reflect the contents of\ncom003. The modify stuff, add, commit, done.\n\n> Now I'm thinking about a much simpler solution: Simply declare the\n> current set of files as (a modified) master/com005 and commit them.\n> A \"cp $GIT_DIR/master $GIT_DIR/HEAD\" followed by a commit would do\n> it.\n> \n> Now my question: Is it safe to tweak the files in $GIT_DIR this way\n> or will this corrupt the repository?\n\nIgnoring that $GIT_DIR/master is the wrong path, that 'cp' would (at\nbest) act like detaching HEAD.\n\nBjörn\n"},{"id":"126596","messageId":"20091102154831.GC27126@dpotapov.dyndns.org","threadId":"21455","inReplyTo":"8470D32E-2CAA-4E3F-8BA0-B4578372A3C4@jump-ing.de","subject":"Re: Binary files in a linear repository","fromName":"Dmitry Potapov","fromEmail":"dpotapov@gmail.com","sentAt":"2009-11-02T15:48:31Z","receivedAt":"2009-11-02T15:48:31Z","isPatch":false,"sender":{"key":"dpotapov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/6568595?v=4"},"body":"On Mon, Nov 02, 2009 at 04:08:25PM +0100, Markus Hitter wrote:\n>\n> Now I'm thinking about a much simpler solution: Simply declare the  \n> current set of files as (a modified) master/com005 and commit them. A  \n> \"cp $GIT_DIR/master $GIT_DIR/HEAD\" followed by a commit would do it.\n>\n> Now my question: Is it safe to tweak the files in $GIT_DIR this way or \n> will this corrupt the repository?\n\nYou probably should use 'git update-ref' if you want to change HEAD\nmanually. But it seems to me that you do not need even that. All what\nyou need is:\n\n$ git reset --soft master\n\nand then commit your changes (git reset --soft does not touch the index\nfile nor the working tree at all).\n\n\nDmitry\n"},{"id":"126599","messageId":"20091102160903.GA6197@atjola.homenet","threadId":"21455","inReplyTo":"20091102154831.GC27126@dpotapov.dyndns.org","subject":"Re: Binary files in a linear repository","fromName":"Björn Steinbrink","fromEmail":"b.steinbrink@gmx.de","sentAt":"2009-11-02T16:09:03Z","receivedAt":"2009-11-02T16:09:03Z","isPatch":false,"sender":{"key":"b.steinbrink@gmx.de","avatar":"https://avatars.githubusercontent.com/u/230962?v=4"},"body":"On 2009.11.02 18:48:31 +0300, Dmitry Potapov wrote:\n> On Mon, Nov 02, 2009 at 04:08:25PM +0100, Markus Hitter wrote:\n> >\n> > Now I'm thinking about a much simpler solution: Simply declare the  \n> > current set of files as (a modified) master/com005 and commit them. A  \n> > \"cp $GIT_DIR/master $GIT_DIR/HEAD\" followed by a commit would do it.\n> >\n> > Now my question: Is it safe to tweak the files in $GIT_DIR this way or \n> > will this corrupt the repository?\n> \n> You probably should use 'git update-ref' if you want to change HEAD\n> manually. But it seems to me that you do not need even that. All what\n> you need is:\n> \n> $ git reset --soft master\n> \n> and then commit your changes (git reset --soft does not touch the index\n> file nor the working tree at all).\n\nBut then you still have to do:\ngit checkout master\ngit merge HEAD@{1}\n\nTo actually update the \"master\" branch head. The reset doesn't re-attach\nHEAD.\n\nBjörn\n"},{"id":"126603","messageId":"20091102165215.GD27126@dpotapov.dyndns.org","threadId":"21455","inReplyTo":"20091102160903.GA6197@atjola.homenet","subject":"Re: Binary files in a linear repository","fromName":"Dmitry Potapov","fromEmail":"dpotapov@gmail.com","sentAt":"2009-11-02T16:52:15Z","receivedAt":"2009-11-02T16:52:15Z","isPatch":false,"sender":{"key":"dpotapov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/6568595?v=4"},"body":"On Mon, Nov 02, 2009 at 05:09:03PM +0100, Björn Steinbrink wrote:\n> On 2009.11.02 18:48:31 +0300, Dmitry Potapov wrote:\n> > On Mon, Nov 02, 2009 at 04:08:25PM +0100, Markus Hitter wrote:\n> > >\n> > > Now I'm thinking about a much simpler solution: Simply declare the  \n> > > current set of files as (a modified) master/com005 and commit them. A  \n> > > \"cp $GIT_DIR/master $GIT_DIR/HEAD\" followed by a commit would do it.\n> > >\n> > > Now my question: Is it safe to tweak the files in $GIT_DIR this way or \n> > > will this corrupt the repository?\n> > \n> > You probably should use 'git update-ref' if you want to change HEAD\n> > manually. But it seems to me that you do not need even that. All what\n> > you need is:\n> > \n> > $ git reset --soft master\n> > \n> > and then commit your changes (git reset --soft does not touch the index\n> > file nor the working tree at all).\n> \n> But then you still have to do:\n> git checkout master\n> git merge HEAD@{1}\n> \n> To actually update the \"master\" branch head. The reset doesn't re-attach\n> HEAD.\n\nYou are right... I forgot about that somehow. So, it should be\n\n$ git reset --soft master\n$ git checkout master\n\nand only then\n\n$ git commit\n\n\nDmitry\n"},{"id":"126606","messageId":"20091102170106.GA8650@atjola.homenet","threadId":"21455","inReplyTo":"20091102165215.GD27126@dpotapov.dyndns.org","subject":"Re: Binary files in a linear repository","fromName":"Björn Steinbrink","fromEmail":"b.steinbrink@gmx.de","sentAt":"2009-11-02T17:01:06Z","receivedAt":"2009-11-02T17:01:06Z","isPatch":false,"sender":{"key":"b.steinbrink@gmx.de","avatar":"https://avatars.githubusercontent.com/u/230962?v=4"},"body":"On 2009.11.02 19:52:15 +0300, Dmitry Potapov wrote:\n> On Mon, Nov 02, 2009 at 05:09:03PM +0100, Björn Steinbrink wrote:\n> > On 2009.11.02 18:48:31 +0300, Dmitry Potapov wrote:\n> > > On Mon, Nov 02, 2009 at 04:08:25PM +0100, Markus Hitter wrote:\n> > > You probably should use 'git update-ref' if you want to change HEAD\n> > > manually. But it seems to me that you do not need even that. All what\n> > > you need is:\n> > > \n> > > $ git reset --soft master\n> > > \n> > > and then commit your changes (git reset --soft does not touch the index\n> > > file nor the working tree at all).\n> > \n> > But then you still have to do:\n> > git checkout master\n> > git merge HEAD@{1}\n> > \n> > To actually update the \"master\" branch head. The reset doesn't re-attach\n> > HEAD.\n> \n> You are right... I forgot about that somehow. So, it should be\n> \n> $ git reset --soft master\n> $ git checkout master\n> \n> and only then\n> \n> $ git commit\n\nThat would do, but:\ngit checkout <commit>\n*make changes*\ngit reset --soft master\ngit checkout master\ngit commit\n\nseems unnecessarily complicated, when you could as well do:\ngit read-tree -u --reset <commit>\n*make changes*\ngit commit\n\nBjörn\n"},{"id":"126609","messageId":"20091102174546.GE27126@dpotapov.dyndns.org","threadId":"21455","inReplyTo":"20091102170106.GA8650@atjola.homenet","subject":"Re: Binary files in a linear repository","fromName":"Dmitry Potapov","fromEmail":"dpotapov@gmail.com","sentAt":"2009-11-02T17:45:46Z","receivedAt":"2009-11-02T17:45:46Z","isPatch":false,"sender":{"key":"dpotapov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/6568595?v=4"},"body":"On Mon, Nov 02, 2009 at 06:01:06PM +0100, Björn Steinbrink wrote:\n> \n> That would do, but:\n> git checkout <commit>\n> *make changes*\n> git reset --soft master\n> git checkout master\n> git commit\n> \n> seems unnecessarily complicated, when you could as well do:\n> git read-tree -u --reset <commit>\n> *make changes*\n> git commit\n\nI thought Markus *already* had made changes on that commit, but\nmaybe I misread what he wrote...\n\n\nDmitry\n"},{"id":"126610","messageId":"20091102183740.GA9900@atjola.homenet","threadId":"21455","inReplyTo":"20091102174546.GE27126@dpotapov.dyndns.org","subject":"Re: Binary files in a linear repository","fromName":"Björn Steinbrink","fromEmail":"b.steinbrink@gmx.de","sentAt":"2009-11-02T18:37:40Z","receivedAt":"2009-11-02T18:37:40Z","isPatch":false,"sender":{"key":"b.steinbrink@gmx.de","avatar":"https://avatars.githubusercontent.com/u/230962?v=4"},"body":"On 2009.11.02 20:45:46 +0300, Dmitry Potapov wrote:\n> I thought Markus *already* had made changes on that commit, but\n> maybe I misread what he wrote...\n\nHm, I understood that the described scenario is one he wants to\nimplement in his front-end, and that he was asking for advice how to\ndo it. I guess only Martin can tell for sure, so let's see :-)\n\nBjörn\n"}]}