Several weeks ago, I found myself refactoring some code a colleague of mine in Boulder wrote (I’m in San Francisco). Because I’m impatient, I wanted him to review my changes without going through the normal pomp and circumstance of what’s now commonly referred to as a pull request or code review. I found myself wishing that I could just share my editor tab over the internet so that he could see what I was working on in real-time. Sure, I could have done one of the following:

  • Invite him to a screen sharing session
  • Copy my code to a snippet hosting site and share the link via HipChat
  • Commit the refactored code to my Stash repo and send him a pull request

Most developers would probably have been fine with any of those options, but none was satisfying to me. Bob and I were already engaged in a detailed discussion via HipChat about my refactoring, and being able to code collaboratively would have been ideal.

Bringing it to life

The situation above isn’t a first for me. In fact, it happens all the time – and I’m sure I’m not alone. For ages I’ve longed for a real-time collaborative editor where my code lives. Many have tried to create a solution like this, but none have proved useful for me.

So a few weeks back when my colleague Tim Pettersen and I were discussing what we should work on for our quarterly ShipIt project, I suggested that we solve this problem. One day of hacking later, we managed to produce a solution.

Introducing the Stash Realtime Editor Add-on

The Stash Realtime Editor makes it possible to edit files in real-time directly from the Stash interface – no cloning, no IDE, no local editor. Because it’s in real-time, you can share a link with your colleagues to collaboratively edit or review code together. Once you’re happy with your edits, you can commit them directly to Stash without the need to push your changes up to the repository. Your commit gets stored in a new branch and can be merged in with a simple pull request.

This add-on adds a real-time editor directly into Stash using the fabulous Firebase service and its awesome Firepad operational transform (OT) based editor. OT makes it possible to edit files in real-time with reliability and predictability, and allows users to see what other users are doing inside the editor (e.g., selecting, highlighting, typing, etc.).

The Stash Realtime Editor works even if you lose network connectivity. If you’re working on a file with someone and happen to suspend your laptop, resume your work on a train, and then come back online at home, your changes will sync up exactly as you would expect.

The Stash Realtime Editor is a free add-on for Stash. Look for it in the Atlassian Marketplace…

Learn more