Google docs is the best example for this that we know of.

If I had to build something on these lines which is quick and dirty and makes use of the things that i already know of I would follow this approach.

  1. Create a github repo.
  2. All people who want to edit something collaboratively add them to this repo.
  3. Create a folder called docs in the repo.
  4. Add one md file every file that all people in repo can collaboratively edit.
  5. People clone this repo on their machine.
  6. Open the md file that they want to edit collaboratively.
  7. Push local change to central repo
    1. Write a watch script that auto saves the file every second(reduce this over the time) only if there is a local change. commits the diff and pushes it.
  8. Pull changes from central repo
    1. Even if there is no change still pull the code every second. No conflict then update.
    2. If there is a conflict just create a conflict copy that is mapped to the source md file. Look at how dropbox does is beautifully.

    All notes