{"thread":{"id":"3350","subject":"Genealogical branches","startedAt":"2006-02-16T02:20:29Z","lastAt":"2006-02-16T02:20:29Z","messageCount":1,"participants":["Ron Parker"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"16235","messageId":"1cf1c57a0602151820p32240818j897aed0a527e6175@mail.gmail.com","threadId":"3350","inReplyTo":null,"subject":"Genealogical branches","fromName":"Ron Parker","fromEmail":"rdparker@gmail.com","sentAt":"2006-02-16T02:20:29Z","receivedAt":"2006-02-16T02:20:29Z","isPatch":false,"sender":{"key":"rdparker@gmail.com","avatar":"https://gravatar.com/avatar/76a05f80dce0dda79f160ace37597a89ea7932279d593b55c2d2bcb4ae62bca6?d=mp&s=160"},"body":"I am working on a stepped tutorial that walks the user through the\ndevelopment of a number of related files. I have been trying to keep\nthis under various SCMs. Currently git seems like the best match. But\nI have some questions.\n\nThe issue is that I want to have a directory which will ultimately\ncontain selected portions of the final products genealogy in addition\nto other files. For example:\n\n        README\n        ...\n        test1\n        test2\n        test3a\n        test3b\n        ...\n\nAnd each step is developed from the preceding one. However, not being\nperfect, there have been occasions where I have found mistakes in an\nearlier step that need to be corrected and propagated to the later\nsteps.\n\nI have found a work flow that seems to do what I want, but there may\nbe a better way to do this and I would like some advice. I initialize\nthe DB and work on test1, that is then branched to step2 where test1\nis first renamed and then modified to become test2.\n\nAt this point I create a \"final\" branch and through some shenanigans I\ndon't completely understand, I pull from master and B2 to get both\nstep1 and step2 into final with their full history. Then as changes\nare made to step1 I can pull those into later steps. Another tricky\npart is that when I get to final, I have to pull from all of the\nancestral branches simultaneously.\n\nAnyway, here is an annotated script that illustrates this, it is also\nattached without the extra commentary:\n\n--- BEGIN GENETEST.SH ---\nmkdir genetest\ncd genetest\ngit init-db\ncat - >test1 <<EOF\naaaaaaaa\nBBBBBBBB\ncccccccc\nEOF\necho README>README\ngit add .\ngit commit -a -m \"Initial checkin\"\n\n# Create step2 branch\ngit checkout -b step2\ngit mv test1 test2\ngit commit -a -m \"Created step2\"\necho dddddddd>>test2\necho \"README 2\">README\ngit commit -a -m \"Added step2 changes\"\n\n# Create conglomerate branch\ngit checkout master\ngit checkout -b final\n\n# This is where the shenanigans come in. I'm not even completely sure\n#  why it works. But arrived at the first two commands through\n# experimentation. I thought one or the other would suffice, but\n# neither alone did.  The two together, however, bring this basically\n# up to step2 status with test1 being deleted and a step2->step2\n# merge indicated in the log.\ngit fetch -a . step2\ngit pull -a . step2\n\n# So then this finds the deleted file and brings it back in from master.\nFILES=$(git-diff-index --name-only --diff-filter=D master)\ngit add $FILES\n\ngit commit -a -m \"Created final\"\n\n# Now let's go modify master and see whether or not changes\n# propagate forward to both files in final.\ngit checkout master\ncat - >test1 <<EOF\naaaaaaaa\nbbbbbbbb\ncccccccc\nEOF\ngit commit -a -m \"Fixed the B... line\"\n\n# Pull the changes into step2 and resolve the conflict from the\n# too-close-together line changes.\ngit checkout step2\ngit pull . master || true\nmv -f test1 test2\necho dddddddd>>test2\nMSG=$(cat .git/MERGE_MSG)\ngit commit -a -m \"$MSG\"\n\n# Now check that all changes come through successfully,\n# the interesting thing is that all the \"ancestor\" branches\n# MUST be pulled at together or things don't work.\ngit checkout final\ngit pull . master step2\n\n# Check that README matches the one from step2\n# and that the B... line has been corrected in both\n# versions of the ancestor file.\ncat README\ncat test1\ncat test2\n\n# If we've gotten this far, say so.\necho SUCCEEDED\n--- END GENETEST.SH ---\n\nSo can anyone explain why the mystery portions \"work\" and why I have\nto pull from all the ancestral branches simultaneously?\n\nAlso, if you have a better solution or work flow I'm open to it.\n\nThanks,\n\n--\nRon Parker\n"}]}