# Shared workspaces

> Keep a workspace in sync with the people you share it with: changes save and travel by themselves, History keeps every one, and a change you both made asks one choice.

**Private access. Public signup is not open.**

<!-- SOURCE: docs/decisions/0151-a-shared-workspace-keeps-itself-in-sync.md, docs/synced-workspaces.md, internal/home/synced.go, internal/home/synced_pass.go, internal/home/synced_api.go, internal/home/synced_share.go, src/lib/KeepInSync.svelte, src/lib/SyncLine.svelte, src/lib/syncLine.ts, src/lib/synced.svelte.ts, src/lib/SyncedHistory.svelte, src/lib/SyncedChoice.svelte, src/lib/LetterWorkspace.svelte, src/lib/FileTree.svelte, src/lib/Topbar.svelte, src/styles/synced.css -->

A workspace can keep itself in sync. It stays an ordinary folder in each
person's Space, which you, the people you share it with and Kin all change
directly. Space saves every change under the name of whoever made it, brings in
everyone else's and sends yours, about once a minute. Nobody needs to commit,
push, pull or merge.

Underneath, the shared copy is the workspace's repository on GitHub, and Space
uses each person's own GitHub connection to reach it.

## Turn it on

A workspace kept on GitHub has a **Keep in sync** card on its Overview. Turn on
its switch and confirm. From then on:

- an edit you save in Files is saved and sent about fifteen seconds after you
  stop typing;
- what Kin changes is saved when her turn ends, marked as made by you with Kin;
- anything changed elsewhere, such as in a terminal, is saved at the next
  check, about once a minute.

Use it for a workspace you share. A workspace you develop in with your own Git
habits is better left as it is: Keep in sync commits everything that changes
there.

Turning the switch off stops syncing and leaves the folder and its history as
they are.

## See where it stands

The end of the workspace's bar says how it stands:

- **Synced · just now** in quiet ink when all is well.
- **Trevor changed 2 files · just now** when someone else's changes arrive.
  Those files, and the folders that hold them, carry a mark in Files until you
  open each one.
- **One file needs a choice** when two people changed the same lines (below).
- **Waiting to sync**, with how many of your changes are kept here, when GitHub
  has been out of reach for five minutes. Keep working; your changes go when it
  can be reached.
- **Can't sync · connect GitHub** when your Space has no GitHub connection, or
  it lapsed. Select it to open **Connections** and connect GitHub.
- **Can't sync · no access** when GitHub refuses you the repository. Ask
  whoever shared it for access.
- **Can't sync · other branch** when the folder is on a branch other than the
  one the repository shares on GitHub. Your changes wait in the folder; switch
  back to that branch to sync. **Share** asks you to do the same.

On a narrower window the line keeps a few of its words, and on a phone just its
mark; its tooltip says it all. Select it to open History, or the file it names.

## History

A synced workspace has **History** beside Source. It lists every change, newest
first and by day: who made it, **with Kin** where Kin helped, and what it
changed. Select a change to see the lines each file gained and lost, then:

- **View** opens the file.
- **Restore** puts that change's files back as they were before it. It asks
  first, and the restore is a new change of its own, so nothing is lost and the
  change you restored stays in History.

## When two people changed the same lines

Changes to different files, or different parts of one file, combine by
themselves. When you both changed the same lines before either saw the other's
change, the workspace keeps syncing everything else and asks one choice. The
file carries the warning mark, and opening it shows a card with both versions:

- **Keep yours** or **Keep Trevor's** keeps that version.
- **Ask Kin to combine** starts a conversation in the workspace asking Kin to
  merge the two and show you the result before she saves it.

Whichever version you don't keep stays in History. Either of you can settle the
choice; the other sees the result. PDFs, spreadsheets and other files that
can't be combined line by line are offered the same way.

## Share a workspace

You can share a synced workspace with someone you
[exchange letters](/docs/space/letters/) with. Both of your Spaces need this
release.

1. On the **Keep in sync** card, select **Share with…**.
2. Choose the person and write their GitHub username. Space remembers it for
   next time.
3. Select **Share**. Space gives their GitHub account access to the repository
   through your GitHub connection, and opens your desk to them with the
   workspace on it and a few words you can change.
4. Seal the letter.

In their Space, the letter shows the workspace after its words with **Add to my
Space**. That accepts the access through their own GitHub connection, copies the
workspace into their Space and turns on Keep in sync. Once it is there, the
letter offers **Open** instead.

Sharing a repository on GitHub needs admin access to it. If either of you has
no GitHub connection yet, or it lapsed, **Share** and **Add to my Space** say
so and offer **Open Connections** to connect GitHub first. Pressing **Add to my
Space** twice adds the workspace once.

## What sharing doesn't do

- It doesn't edit live together: each person's Space keeps its own copy, and
  changes travel within about a minute.
- It doesn't hide anything from the people you share with: everything saved in
  the workspace reaches them, so keep passwords and keys out of it entirely.
- It doesn't rewrite history: every change, restore and choice is a new change.

_Source authority: Kinra Site (src/content/docs/space/sharing.md)._
