RE: Beginner's question on how to use git for multiple parallel versions
- From
Bill Lear <rael@zopyra.com>
- Date
- Jan 4, 2010, 15:44 UTC
- Message-ID
- <19266.3277.221519.791489@blake.zopyra.com>
- In-Reply-To
- <22D57EF90F8E4A2799F739FC14F8BA63@Duthler.local>
On Monday, January 4, 2010 at 14:35:25 (+0100) Christian C. Schouten writes:
Show 11 quoted lines
>Dear Bill, > >Thanks for your prompt reply. It may very well be exactly what I need, but >I'm afraid that I don't understand the syntax just yet (am still in the >phase orienting on what version management is and how it should be set up). > >Could you please add to your answer whether I am using branches or another >git technique (terminology?) and whether these are instructions that I can >use to commit a change once the system has already been set up or if these >actually are the instructions for defining the multiplicity of my project >versions?
In my example, I used branches, but did not show how to set them up. Here is the complete example, complete with repository and branch creation; you would start your project here:
# Set up repo and add first file to main branch: % mkdir my_project % cd my_project % git init % echo "main line process stuff" > process.bpel % git add process.bpel % echo "<non-version-specific table info>" > table.xml % git add table.xml % git commit -a -m "First commit on master branch"
# Create branch A and branch B: % git branch A % git branch B
# Modify file on branch A: % git checkout A % echo "<table A>" > table.xml % git commit -a -m "Modify table on Branch A"
# Modify file on branch B: % git checkout B % echo "<table B>" > table.xml % git commit -a -m "Modify table on Branch B"
# Now go back to master and make some changes on common file: % git checkout master % cat process.bpel main line process stuff % echo "add more process stuff" >> process.bpel % git commit -a -m "fix process stuff on master"
# Now go to branch A and pull in the common file: % git checkout A % git merge master % cat process.bpel main line process stuff add more process stuff
# Now go to branch B and pull in the common file: % git checkout B % git merge master % cat process.bpel main line process stuff add more process stuff
That should be just about all you need.
Bill