title: How can I merge multiple revisions of notes together into a single version?
body: <p>Forgive me if this question has been asked before. I'm sure it has since a classic problem. But nevertheless, I will ask it since I couldn't locate a solution.</p>
  
  <ul>
  <li>I have a mongo/mongoose/node stack API for a note taking application.</li>
  <li>Users of the app can open it up in different devices or browser tabs and sometimes end up overriding their own notes.</li>
  </ul>
  
  <p>Here is a time-linear example of a single user with different mediums which encounters the problem:</p>
  
  <ol>
  <li>User opens app in phone (offline)</li>
  <li>Later, User opens the app
  in browser and edits a specific note.</li>
  <li>User goes back to app in phone and edits same note. Now the phone app. overrides the edits made in #2 because phone was "out of sync".</li>
  </ol>
  
  <p>There are two main problems:<br>
  1. The app does not initiate a sync. It remains out of sync unless the user manually clicks refresh.<br>
  2. Merging of the two notes is difficult because it's not as simple as the last one being the authoritative one but rather, I think that it needs to merge the two together elegantly (think github diff)</p>
  
  <p>What is a known strategy for handling such problem? My initial research points to something like jsdiff which highlights differences but it does not take into account syncing and revision resolution with mongoose.</p>
  
  <p>TLDR;
  I got multiple notes. I need to merge them. They may vary.</p>