GitHub’s Realtime Collaboration for Software Development

GitHub is evolving with new features like Realtime GitHub, which are designed to enhance online collaboration for software developers. Realtime GitHub is a prototype of multiplayer collaboration, allowing team members to instantly edit files in a repository together. Even though it's in real-time, it maintains GitHub's asynchronous work practices, such as pulling changes from other branches and merging back when ready.

Collaborative Workspaces at Next

Next is a distributed team that uses Google Docs for most writing tasks due to its user-friendly rich-text editing, ease of sharing through URLs, and the ability to collaborate in real-time. However, Google Docs has disadvantages, like being siloed from repositories and project materials, lacking a versioning system with other files, and not providing privacy for draft revisions.

Realtime GitHub's Approach

Realtime GitHub borrows the collaborative elements of Google Docs but tailors them for software development. It allows real-time editing, presence of cursor and selection, threaded comments with emojis, and supports GitHub's inherent asynchronous work style. A branch can be a private or collaborative space; after collaboration, changes can be merged back into the main branch.

Technical Underpinnings

Realtime GitHub must handle unique challenges: maintaining a consistent view of the entire codebase, providing both synchronous and asynchronous collaboration, and integrating with various artifacts and external tools. It aims to ensure that branching from any edit state is uncomplicated, and merging back the changes is seamless.

Existing CRDT Libraries

While existing Conflict-free Replicated Data Types (CRDT) libraries offer decentralized collaboration for a large number of users, they aren't designed with GitHub's specific requirements in mind. Therefore, GitHub is exploring different design spaces to serve its collaboration needs better.

Collaboration Design

Some specific tools and concepts involved in this new approach include:

  • ProseMirror and Tiptap for document editing
  • Yjs and Automerge for collaborative state management
  • Replicache, Irmin, and other libraries for replicating changes across clients

GitHub also adopts ordinary Git operations to manage collaborative editing. The server notifies clients of branch changes, and clients pull changes, apply them locally, then submit changes back to the server. If conflicts occur, they rebased the changes and try again.

Additional Strategies

For fine-grained real-time changes, clients write transactions updating the server's Git state and rebasing local changes. For coarse-grained changes like merges, they perform a three-way merge on the JSON structure, with manual resolution of conflicts when necessary.

Future Integration and Tools

Looking ahead, GitHub plans to:

  • Integrate Realtime GitHub backend with other platforms, such as a VS Code plugin or Copilot Workspaces
  • Explore deeper integration with GitHub features, including embedding data from issues and actions
  • Utilize additional collaboration tools like tldraw, CodeMirror, and Monaco

Realtime GitHub is a promising step for developers who collaborate online, blending real-time teamwork with the strengths of systematic version control.


Tags

  • Realtime Collaboration
  • Software Development
  • GitHub Features
  • Online Collaborative Workspaces

https://githubnext.com/projects/rtgh/