How Does GitHub Merge Web-Based Wiki Edits With Ones Through The Repository?

git, github, merge, merge-conflict-resolution

Solution

Every change made to a GitHub wiki, regardless of whether it's done in the web interface or through git, is its own commit in the repository.

If you add, edit, or delete a wiki page through the web interface and then `git pull` the wiki repository, you can see the edit with `git history`. If you're the owner or a collaborator on the project that the wiki belongs to, you can even revert that commit and push the changes back to GitHub using git (I've personally had to do this to recover a page that was accidentally deleted).

For the situation you describe, it appears (according to this issue) that the last edit wins and the content of the first edit is lost.

For a more specific answer than that, you might want to take a look at the Gollum project, which is what GitHub uses to manage its git-backed wikis.

Problem

I'm toying with the idea of providing some kind of Git access to resources used by a SaaS application to it's users. This will allow users to edit and push content through the Git interface as well as through the application's native web-based interface. My main concern is how to reconcile merge conflicts when a user edit's the content in the web-based interface (I'm not so concerned about merge conflicts from the Git interface since Git and their Git client should handle that). This is very similar to how GitHub allows both Git-based and web-based access to their Wikis, and I'm curious how they handle this situation as a pattern for others to follow when providing both web-based and Git-based access to content. If a user goes to edit a Wiki page on GitHub through the web interface and another user pushes a change to the Wiki repository branch before they finish, what happens when they save their changes? Does it use a "last one wins" or a "sorry, redo all your changes on the new version"? I found a related SO post that discussed the problem in general, but I'm very curious how GitHub specifically handles it since it's backed by Git which already has some merging capabilities baked in.

Original source

Related problems