{"thread":{"id":"22091","subject":"Beginner's question on how to use git for multiple parallel versions","startedAt":"2010-01-04T11:29:52Z","lastAt":"2010-01-04T15:44:13Z","messageCount":5,"participants":["Christian C. Schouten","Bill Lear","Dmitry Potapov"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"130762","messageId":"F8CC469C9CCA415696101414EA997C0.MAI@sohosted19.com","threadId":"22091","inReplyTo":null,"subject":"Beginner's question on how to use git for multiple parallel versions","fromName":"Christian C. Schouten","fromEmail":"info@zark3.net","sentAt":"2010-01-04T11:29:52Z","receivedAt":"2010-01-04T11:29:52Z","isPatch":false,"sender":{"key":"info@zark3.net","avatar":null},"body":"Hello all,\n\nI&#8217;ve got a project that I want to do version management on with git but being a beginner in\ncvs/svn/dvcs etc. terminology I don&#8217;t know yet how to set it up.\nMy project needs to exist as several parallel copies, i.e. there is a &#8220;main version&#8221; in\nwhich I do my development but it needs to end up being available as a couple of different\nconfigurations.\nFor instance, say there is a file table.xml then this needs to contain different rows for versions\nA and B. Likewise, a file process.bpel needs to be named identical for each version but contain\ndifferent content depending on whether it is distributed as version A or version B. Any changes\nmade in non-version specific files should be visible in all copies, but changes made to\nversion-specific files need to remain isolated to that particular version.\n\nI read about branching, merging, rebasing and cherry-picking commits but I don&#8217;t get it yet.\nCan anyone enlighten me on how I should approach this in a way that I can maintain easily\nthroughout future development for my situation?\n\nThanks in advance for any pointers,\n\nBest,\n\nChris\n\n"},{"id":"130765","messageId":"19265.60728.17437.665860@blake.zopyra.com","threadId":"22091","inReplyTo":"F8CC469C9CCA415696101414EA997C0.MAI@sohosted19.com","subject":"Re: Beginner's question on how to use git for multiple parallel versions","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2010-01-04T13:29:28Z","receivedAt":"2010-01-04T13:29:28Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Monday, January 4, 2010 at 12:29:52 (+0100) Christian C. Schouten writes:\n>Hello all,\n>\n>I've got a project that I want to do version management on with\n>git but being a beginner in cvs/svn/dvcs etc. terminology I\n>don't know yet how to set it up.  My project needs to exist as\n>several parallel copies, i.e. there is a \"main version\" in\n>which I do my development but it needs to end up being available as a\n>couple of different configurations.  For instance, say there is a file\n>table.xml then this needs to contain different rows for versions A and\n>B. Likewise, a file process.bpel needs to be named identical for each\n>version but contain different content depending on whether it is\n>distributed as version A or version B. Any changes made in non-version\n>specific files should be visible in all copies, but changes made to\n>version-specific files need to remain isolated to that particular\n>version.\n\nWhat you are asking for is this, I think:\n\n% git checkout A\n% cat table.xml\n<table A>\n% echo \"<table A v2>\" > table.xml\n% git commit -a -m \"fix table on Branch A\"\n\n% git checkout B\n% cat table.xml\n<table B>\n% echo \"<table B v2>\" > table.xml\n% git commit -a -m \"fix table on Branch B\"\n\n% git checkout master\n% cat table.xml\n<non-version-specific table info>\n% cat process.bpel\nmain line process stuff\n% echo \"add more process stuff\" >> process.bpel\n% git commit -a -m \"fix process stuff on mainline\"\n\n% git checkout A\n% git merge master\n% cat process.bpel\nmain line process stuff\nadd more process stuff\n\n% git checkout B\n% git merge master\n% cat process.bpel\nmain line process stuff\nadd more process stuff\n\nIs that not it?\n\n\nBill\n"},{"id":"130766","messageId":"22D57EF90F8E4A2799F739FC14F8BA63@Duthler.local","threadId":"22091","inReplyTo":"19265.60728.17437.665860@blake.zopyra.com","subject":"RE: Beginner's question on how to use git for multiple parallel versions","fromName":"Christian C. Schouten","fromEmail":"info@zark3.net","sentAt":"2010-01-04T13:35:25Z","receivedAt":"2010-01-04T13:35:25Z","isPatch":false,"sender":{"key":"info@zark3.net","avatar":null},"body":"Dear Bill,\n\nThanks for your prompt reply. It may very well be exactly what I need, but\nI'm afraid that I don't understand the syntax just yet (am still in the\nphase orienting on what version management is and how it should be set up).\n\nCould you please add to your answer whether I am using branches or another\ngit technique (terminology?) and whether these are instructions that I can\nuse to commit a change once the system has already been set up or if these\nactually are the instructions for defining the multiplicity of my project\nversions?\n\nSorry for the newbie-ness and thanks in advance,\n\nBest,\n\nChris\n\n\n-----Original Message-----\nFrom: Bill Lear [mailto:rael@zopyra.com] \nSent: maandag 4 januari 2010 14:29\nTo: Christian C. Schouten\nCc: git@vger.kernel.org\nSubject: Re: Beginner's question on how to use git for multiple parallel\nversions\n\nOn Monday, January 4, 2010 at 12:29:52 (+0100) Christian C. Schouten writes:\n>Hello all,\n>\n>I've got a project that I want to do version management on with\n>git but being a beginner in cvs/svn/dvcs etc. terminology I\n>don't know yet how to set it up.  My project needs to exist as\n>several parallel copies, i.e. there is a \"main version\" in\n>which I do my development but it needs to end up being available as a\n>couple of different configurations.  For instance, say there is a file\n>table.xml then this needs to contain different rows for versions A and\n>B. Likewise, a file process.bpel needs to be named identical for each\n>version but contain different content depending on whether it is\n>distributed as version A or version B. Any changes made in non-version\n>specific files should be visible in all copies, but changes made to\n>version-specific files need to remain isolated to that particular\n>version.\n\nWhat you are asking for is this, I think:\n\n% git checkout A\n% cat table.xml\n<table A>\n% echo \"<table A v2>\" > table.xml\n% git commit -a -m \"fix table on Branch A\"\n\n% git checkout B\n% cat table.xml\n<table B>\n% echo \"<table B v2>\" > table.xml\n% git commit -a -m \"fix table on Branch B\"\n\n% git checkout master\n% cat table.xml\n<non-version-specific table info>\n% cat process.bpel\nmain line process stuff\n% echo \"add more process stuff\" >> process.bpel\n% git commit -a -m \"fix process stuff on mainline\"\n\n% git checkout A\n% git merge master\n% cat process.bpel\nmain line process stuff\nadd more process stuff\n\n% git checkout B\n% git merge master\n% cat process.bpel\nmain line process stuff\nadd more process stuff\n\nIs that not it?\n\n\nBill\n"},{"id":"130769","messageId":"37fcd2781001040635t12183269rd24f34bf05a5d788@mail.gmail.com","threadId":"22091","inReplyTo":"F8CC469C9CCA415696101414EA997C0.MAI@sohosted19.com","subject":"Re: Beginner's question on how to use git for multiple parallel versions","fromName":"Dmitry Potapov","fromEmail":"dpotapov@gmail.com","sentAt":"2010-01-04T14:35:23Z","receivedAt":"2010-01-04T14:35:23Z","isPatch":false,"sender":{"key":"dpotapov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/6568595?v=4"},"body":"Hi,\n\nOn Mon, Jan 4, 2010 at 2:29 PM, Christian C. Schouten <info@zark3.net> wrote:\n>\n> I&#8217;ve got a project that I want to do version management on with git but being a beginner in\n> cvs/svn/dvcs etc. terminology I don&#8217;t know yet how to set it up.\n> My project needs to exist as several parallel copies, i.e. there is a &#8220;main version&#8221; in\n> which I do my development but it needs to end up being available as a couple of different\n> configurations.\n\nOne way to achieve that is to use branches. You create a mainline\nbranch that will contain\nwhat is common for all versions, and then create a few specific\nbranches from it. Each branch\nwill contain their own files, as well as modifications to some common\nfiles if it is necessary.\n\nChanges that a common to all branches should be committed to the\nmainline, which is merged\nto each version specific branch.\n\nGit allows to quickly switch between branches, so you stay in all\nworktree all the time.\nMoreover, if you made modifications to some file on branchA but then\nrealized that it should\nbe commit to another branch, you can switch to another branch as usual\nas long as the\nmodified files are the same on both branches. (If it is not the case,\nyou can use git stash).\n\nDmitry\n"},{"id":"130770","messageId":"19266.3277.221519.791489@blake.zopyra.com","threadId":"22091","inReplyTo":"22D57EF90F8E4A2799F739FC14F8BA63@Duthler.local","subject":"RE: Beginner's question on how to use git for multiple parallel versions","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2010-01-04T15:44:13Z","receivedAt":"2010-01-04T15:44:13Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Monday, January 4, 2010 at 14:35:25 (+0100) Christian C. Schouten writes:\n>Dear Bill,\n>\n>Thanks for your prompt reply. It may very well be exactly what I need, but\n>I'm afraid that I don't understand the syntax just yet (am still in the\n>phase orienting on what version management is and how it should be set up).\n>\n>Could you please add to your answer whether I am using branches or another\n>git technique (terminology?) and whether these are instructions that I can\n>use to commit a change once the system has already been set up or if these\n>actually are the instructions for defining the multiplicity of my project\n>versions?\n\nIn my example, I used branches, but did not show how to set them up.\nHere is the complete example, complete with repository and branch\ncreation; you would start your project here:\n\n# Set up repo and add first file to main branch:\n% mkdir my_project\n% cd my_project\n% git init\n% echo \"main line process stuff\" > process.bpel\n% git add process.bpel\n% echo \"<non-version-specific table info>\" > table.xml\n% git add table.xml\n% git commit -a -m \"First commit on master branch\"\n\n# Create branch A and branch B:\n% git branch A\n% git branch B\n\n# Modify file on branch A:\n% git checkout A\n% echo \"<table A>\" > table.xml\n% git commit -a -m \"Modify table on Branch A\"\n\n# Modify file on branch B:\n% git checkout B\n% echo \"<table B>\" > table.xml\n% git commit -a -m \"Modify table on Branch B\"\n\n# Now go back to master and make some changes on common file:\n% git checkout master\n% cat process.bpel\nmain line process stuff\n% echo \"add more process stuff\" >> process.bpel\n% git commit -a -m \"fix process stuff on master\"\n\n# Now go to branch A and pull in the common file:\n% git checkout A\n% git merge master\n% cat process.bpel\nmain line process stuff\nadd more process stuff\n\n# Now go to branch B and pull in the common file:\n% git checkout B\n% git merge master\n% cat process.bpel\nmain line process stuff\nadd more process stuff\n\nThat should be just about all you need.\n\n\nBill\n"}]}