tags:

views:

28

answers:

3

I am interested in doing the following. I would like to maintain one master copy of a document, and then have branches for that document that could include minor modifications. I want modifications in the branches of this document to be merged with any changes I make with the major document.

It is like being able to update a "template" and the instantiation of that template. What good tools are there for doing something like that? Can svn do it? (You can assume the documents are just text files, no fancy format.)

A: 

Yes, svn can do this. For svn there's no difference whether it's managing source code or other txt files. It might not be ideal if you're adding at the bottom of the document on 2 branches though, but I think any SCM system will have a conflict in that situation.

Sander Rijken
A: 

git might be an option as well. Have a look at A successful Git branching model. Each 'modified document' can be treated as a feature branch, while your 'template' lives in trunk.

Working with feature branches works with 'svn' as well.

zellus
A: 

You will have problems merging changes from your "template" to the branched version if the files your versionize are binary, not text-files. All Microsoft FOrmats (and openoffice compressed files) are binary blobs. Merges in most version control systems I know are done to the line granularity.

Apart from that yes it is very possible.

svn copy trunk/mydoc.txt branches/branch1/mydoc.txt
svn copy trunk/mydoc.txt branches/branch2/mydoc.txt

if you later change your verson in trunk you can propagate the change down to your feature-branches.

cd branches/branch1
svn merge http://mysvnserver.tld/reponame/trunk/mydoc.txt
svn commit
cd ../..
cd branches/branch2
svn merge http://mysvnserver.tld/reponame/trunk/mydoc.txt
svn commit

This is the simplified procedure. It is also best practice to not branch and merge individual files but on the highest level possible (branch level).

Christoph Strasen