{"thread":{"id":"7153","subject":"Advice on strategy for \"temporary\" commits","startedAt":"2007-03-08T14:39:46Z","lastAt":"2007-03-11T05:22:48Z","messageCount":7,"participants":["David Tweed","Alex Riesen","J. Bruce Fields","Mark Wooding","Jakub Narebski"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"36623","messageId":"e1dab3980703080639i4c553e89nb931c2aea45b023b@mail.gmail.com","threadId":"7153","inReplyTo":null,"subject":"Advice on strategy for \"temporary\" commits","fromName":"David Tweed","fromEmail":"david.tweed@gmail.com","sentAt":"2007-03-08T14:39:46Z","receivedAt":"2007-03-08T14:39:46Z","isPatch":false,"sender":{"key":"david.tweed@gmail.com","avatar":null},"body":"Hi,\n\nI've been working with my system taking automatic\nhourly git snapshots of (filtered portions of) my home\ndirectory for a couple of months. Being able to look\nback to what files looked like mid-afternoon yesterday,\nor on 18 Nov, is proving modestly useful. However,\nI'm thinking about adding \"temporary\" commits every\nten minutes which then get discarded after 5 hours-ish\n(in addition to the long-term archival hourly commits).\nThis is motivated by the desire to have finer granularity\nfor testing/bisecting short-term regressions but not having\nridiculously fine-grained changes clogging up the\narchive long-term. (I'm aware that with the commits\nbeing primarily taken on a timed basis I'll have more\nnon-compiling changes than is usual in a repository, so\nthat this may not turn out to be useful in practice.)\n\nLooking through the git docs, it looks like the most\nnatural way of doing this is to make the 10-min commits\n(via cron & tagging them under a special tag \"temporary\ncommits only\" directory) and then use\n\ngit-rebase --onto start-tag end-tag branch\n\nevery so often (via cron again) to chop the older\ntemporary commits between start-tag and end-tag\nout of the database.\n\nHowever, I'm not remotely expert on all the other\nthings you can do with git, so I'm just checking\nthere's not a way considered better/safer (eg, a separate\nbranch or repository).\n\nMany thanks for any insight,\n-- \ncheers, dave tweed__________________________\ndavid.tweed@gmail.com\nRm 124, School of Systems Engineering, University of Reading.\nDetails are all that matters; God dwells there, and you never get to\nsee Him if you don't struggle to get them right. -- Stephen Jay Gould\n"},{"id":"36632","messageId":"81b0412b0703080811m27ff892eg5bf1cdf93f89051a@mail.gmail.com","threadId":"7153","inReplyTo":"e1dab3980703080639i4c553e89nb931c2aea45b023b@mail.gmail.com","subject":"Re: Advice on strategy for \"temporary\" commits","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-03-08T16:11:58Z","receivedAt":"2007-03-08T16:11:58Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On 3/8/07, David Tweed <david.tweed@gmail.com> wrote:\n> I've been working with my system taking automatic\n> hourly git snapshots of (filtered portions of) my home\n> directory for a couple of months. Being able to look\n> back to what files looked like mid-afternoon yesterday,\n> or on 18 Nov, is proving modestly useful. However,\n> I'm thinking about adding \"temporary\" commits every\n> ten minutes which then get discarded after 5 hours-ish\n> (in addition to the long-term archival hourly commits).\n> This is motivated by the desire to have finer granularity\n> for testing/bisecting short-term regressions but not having\n> ridiculously fine-grained changes clogging up the\n> archive long-term. (I'm aware that with the commits\n> being primarily taken on a timed basis I'll have more\n> non-compiling changes than is usual in a repository, so\n> that this may not turn out to be useful in practice.)\n\nTry using temporary and primary branch. Commit\n10-minutes to the temporary branch, reset it to the\nhead of primary branch after you did a commit to\nit and repack. Commits from temporary branch will\nbe removed.\nYou even can setup/modify your editor, to do a\ntemporary commit every time you save a file, for\nextra ganularity.\n"},{"id":"36633","messageId":"20070308163239.GH22713@fieldses.org","threadId":"7153","inReplyTo":"e1dab3980703080639i4c553e89nb931c2aea45b023b@mail.gmail.com","subject":"Re: Advice on strategy for \"temporary\" commits","fromName":"J. Bruce Fields","fromEmail":"bfields@fieldses.org","sentAt":"2007-03-08T16:32:39Z","receivedAt":"2007-03-08T16:32:39Z","isPatch":false,"sender":{"key":"bfields@citi.umich.edu","avatar":null},"body":"On Thu, Mar 08, 2007 at 02:39:46PM +0000, David Tweed wrote:\n> Hi,\n> \n> I've been working with my system taking automatic\n> hourly git snapshots of (filtered portions of) my home\n> directory for a couple of months. Being able to look\n> back to what files looked like mid-afternoon yesterday,\n> or on 18 Nov, is proving modestly useful. However,\n> I'm thinking about adding \"temporary\" commits every\n> ten minutes which then get discarded after 5 hours-ish\n> (in addition to the long-term archival hourly commits).\n> This is motivated by the desire to have finer granularity\n> for testing/bisecting short-term regressions but not having\n> ridiculously fine-grained changes clogging up the\n> archive long-term. (I'm aware that with the commits\n> being primarily taken on a timed basis I'll have more\n> non-compiling changes than is usual in a repository, so\n> that this may not turn out to be useful in practice.)\n> \n> Looking through the git docs, it looks like the most\n> natural way of doing this is to make the 10-min commits\n> (via cron & tagging them under a special tag \"temporary\n> commits only\" directory) and then use\n> \n> git-rebase --onto start-tag end-tag branch\n> \n> every so often (via cron again) to chop the older\n> temporary commits between start-tag and end-tag\n> out of the database.\n\nYou don't want to run git-rebase out of a cron job, because it may\nrequire human interaction.\n\nThe simplest thing might be to make the temporary commits onto a\nseparate branch, and throw that branch away periodically.\n\n--b.\n"},{"id":"36636","messageId":"e1dab3980703080907v58739287p18bc2797db7d209e@mail.gmail.com","threadId":"7153","inReplyTo":"20070308163239.GH22713@fieldses.org","subject":"Re: Advice on strategy for \"temporary\" commits","fromName":"David Tweed","fromEmail":"david.tweed@gmail.com","sentAt":"2007-03-08T17:07:56Z","receivedAt":"2007-03-08T17:07:56Z","isPatch":false,"sender":{"key":"david.tweed@gmail.com","avatar":null},"body":"> You don't want to run git-rebase out of a cron job, because it may\n> require human interaction.\n>\n> The simplest thing might be to make the temporary commits onto a\n> separate branch, and throw that branch away periodically.\n\nThanks to you & Alex for suggesting this.\n\nSo, at this point I need to ask an embarassingly basic\nquestion: how do I \"change branches\" from T (say), in order to commit\nto a different branch A, without changing the contents of\nthe working directory back to match what it was at the\ntime of the last commit to A? (I know this is not the\nthing you normally want to do.) Ie, in terms of diagrams\nI've got my archival commit branch with its hourly\ncommits running along the top and the temporary branch\nwith its temporary commits running along the bottom\nand a $ means that, considered just as commited trees\nthe objects linked are the same:\n\na-----------a-----------a\n \\          $           $\n  \\-t---t---t---t---t---t---t---t\n\n(In case it's not clear, the \"temporary branch\" record\nextends past the last \"archival commit\" and throwing\naway the temporary commits shouldn't remove any\narchival commits.)\n\nSo I'm on the temporary branch and have been doing\ntemporary commits to it and we hit an hour mark.\nCron wants to commit what's _currently_ in my working\ndirectory as a new head to the \"archival branch\" A\nand then swap back the temporary branch to\ncommit it on that branch and carry on, ie, make\nthe diagram look like:\n\na-----------a-----------a-----------a\n \\          $           $           $\n  \\-t---t---t---t---t---t---t---t---t\n\nAIUI neither git-branch nor git-checkout provide\na way to do this. (Clearly the git datastructures\ncan represent this situation, I'm just not sure how\nto ask the tools to do it.)\n\nAgain, thanks for all the assistance,\n-- \ncheers, dave tweed__________________________\ndavid.tweed@gmail.com\nRm 124, School of Systems Engineering, University of Reading.\nDetails are all that matters; God dwells there, and you never get to\nsee Him if you don't struggle to get them right. -- Stephen Jay Gould\n"},{"id":"36646","messageId":"slrnev0jtg.7lh.mdw@metalzone.distorted.org.uk","threadId":"7153","inReplyTo":"e1dab3980703080907v58739287p18bc2797db7d209e@mail.gmail.com","subject":"Re: Advice on strategy for \"temporary\" commits","fromName":"Mark Wooding","fromEmail":"mdw@distorted.org.uk","sentAt":"2007-03-08T18:02:24Z","receivedAt":"2007-03-08T18:02:24Z","isPatch":false,"sender":{"key":"mdw@distorted.org.uk","avatar":null},"body":"David Tweed <david.tweed@gmail.com> wrote:\n\n> a-----------a-----------a-----------a\n>  \\          $           $           $\n>   \\-t---t---t---t---t---t---t---t---t\n>\n> AIUI neither git-branch nor git-checkout provide\n> a way to do this. (Clearly the git datastructures\n> can represent this situation, I'm just not sure how\n> to ask the tools to do it.)\n\nYou want the raw git-commit-tree tool.  Suppose your branches are tmp\nand hourly (both in refs/heads).  Something like this should make your\nhourly commit:\n\n\tcommit=$(\n\t  echo hourly-commit |\n\t  git commit-tree refs/heads/tmp^{tree} -p refs/heads/hourly)\n\tgit update-ref -m \"hourly commit\" refs/heads/hourly $commit\n\nIt might be that you should then start basing your temporary commits on\nthe most recent archive, so you should also\n\n\tgit update-ref -m \"hourly commit\" refs/heads/tmp $commit\n\nThen what you'll end up with is something like\n\na-----------a-----------a-----------a\n \\          $\\          $\\          $\n  \\-t---t---t \\-t---t---t \\-t---t---t\n\nDoes that seem sane?\n\n-- [mdw]\n"},{"id":"36672","messageId":"esrbub$bg$1@sea.gmane.org","threadId":"7153","inReplyTo":"e1dab3980703080907v58739287p18bc2797db7d209e@mail.gmail.com","subject":"Re: Advice on strategy for \"temporary\" commits","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-03-09T10:15:01Z","receivedAt":"2007-03-09T10:15:01Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"[Cc: git@vger.kernel.org]\n\nDavid Tweed wrote:\n\n> So, at this point I need to ask an embarassingly basic\n> question: how do I \"change branches\" from T (say), in order to commit\n> to a different branch A, without changing the contents of\n> the working directory back to match what it was at the\n> time of the last commit to A?\n[...]]\n> So I'm on the temporary branch and have been doing\n> temporary commits to it and we hit an hour mark.\n> Cron wants to commit what's _currently_ in my working\n> directory as a new head to the \"archival branch\" A\n> and then swap back the temporary branch to\n> commit it on that branch and carry on, ie, make\n> the diagram look like:\n> \n> a-----------a-----------a-----------a\n>  \\          $           $           $\n>   \\-t---t---t---t---t---t---t---t---t\n> \n> AIUI neither git-branch nor git-checkout provide\n> a way to do this. (Clearly the git datastructures\n> can represent this situation, I'm just not sure how\n> to ask the tools to do it.)\n\nTry if \"git checkout -m\" does what you wanted. Or simply\ndo a merge of \"more often\" branch into \"less often\" branch,\nperhaps simply not recording it as a merge with \n\"git merge --squash\" followed by \"git commit\".\n\nBy the way, you know that you can --amend a commit?\n\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"36790","messageId":"e1dab3980703102122i398d1fa5ib4e629d32134f4e4@mail.gmail.com","threadId":"7153","inReplyTo":"e1dab3980703102101s21401403ja28c6273ecaa7b83@mail.gmail.com","subject":"Advice on strategy for \"temporary\" commits","fromName":"David Tweed","fromEmail":"david.tweed@gmail.com","sentAt":"2007-03-11T05:22:48Z","receivedAt":"2007-03-11T05:22:48Z","isPatch":false,"sender":{"key":"david.tweed@gmail.com","avatar":null},"body":"> Try if \"git checkout -m\" does what you wanted. Or simply\n> do a merge of \"more often\" branch into \"less often\" branch,\n> perhaps simply not recording it as a merge with\n> \"git merge --squash\" followed by \"git commit\".\n>\n> By the way, you know that you can --amend a commit?\n\nJakub suggested primarily being on the temporary branch,\nwhen updating the archival branch is desired to first commit\nto the temporary branch, then switch to the archival branch\nand do a \"git merge --squash temp-branch-name\" and commit.\nThis seems to half-work, in that when it doesn't flag a merge\nconflict it does what I want. Unfortunately it often seems to detect\n\"conflicts\" that aren't conflicts for my usage and which make\nautomatic cron usage impossible, eg,\n-------------------------------- 8< -------------------------------\n$ git merge --squash temp\n 100% (4/4) done\nAuto-merged s\nCONFLICT (content): Merge conflict in s\nSquash commit -- not updating HEAD\nAutomatic merge failed; fix conflicts and then commit the result.\n\n$ more s\nH1\nt1\nt2\n<<<<<<< HEAD:s\n=======\nt4\nt5\n>>>>>>> temp:s\n\n--------------------------------- 8< ----------------------------\nI _think_ if I could specify an opposite of the \"ours\" merge\nstrategy that always takes file contents from the other branches\nhead commit. An alternative might be to see if I can figure out directly\ncommiting the relevant file tree to both branches using low-level\ngit commands avoiding the higher level git processing (since\nthis isn't really a merge of different development but recording\nthe same \"content state\" on two different branches maybe\ntrying to make a \"merge\" work is the wrong idea.)\n\n[In case anyone thinks I'm wrong to want to work primarily from cron\njobs, my rationale is that this stuff is personal to me -- ie,\nwon't be independently changed by anyone else -- and isn't\na focussed product. Years ago I tried using RCS on my home\ndirectory and found I spent lots of time writing contentless\ncommit messages like \"save\nat 11.15 on 05/06/02\" and that during crunch periods I'd\navoid making check-ins because it was too much extraneous\nwork; but these were _precisely_ the times I'd be most likely\nto rush and do some stupid changes I'd want to back out, so it\ndidn't really work and so I stopped using RCS. With my \"safety net\nand historical archive\" usage pattern -- which is different from\nproductised development -- I really want something safe to\nrun from cron.]\n\nAnyway, thanks for all the help.\n\n-- \ncheers, dave tweed__________________________\ndavid.tweed@gmail.com\nRm 124, School of Systems Engineering, University of Reading.\nDetails are all that matters; God dwells there, and you never get to\nsee Him if you don't struggle to get them right. -- Stephen Jay Gould\n"}]}