Skip to content

Git Sync

Keep a docs site and folders of Markdown on GitHub or GitLab in step, in both directions.

Git Sync connects a docs site to a branch of a GitHub repository or a GitLab project, and each of its spaces to a folder on it. Writers work in the editor, engineers work in pull requests, and both see the same pages.

flowchart LR
  E[Editor] -- publish --> S[Space]
  S -- commit --> G[(Git branch)]
  G -- push --> S
  S -- conflicting push --> CR[Change request]

How it works#

  • Docsheaf → Git. Every new published version of the space becomes a commit on the branch, authored with the name of whoever made it. Only files that changed are written.

  • Git → Docsheaf. Every push to the branch is read back. If nobody changed the space in Docsheaf since the last sync, the push is published directly. If both sides changed — or the space requires review — the push opens a change request, which merges like any other, with conflict resolution.

  • Pushes that only touch files outside a space's folder are ignored, and Docsheaf's own commits never come back as changes.

What's in the repository#

The same files as the Markdown export: one .md file per page with front matter, SUMMARY.md as the table of contents, .docsheaf.yaml, and uploads in .docsheaf/assets/. Repositories laid out for GitBook (with .gitbook.yaml) work as they are. See Content configuration.

Commit statuses#

When a push opens a change request, Docsheaf adds a Docsheaf status to the commit on GitHub or GitLab: waiting for review, approved, changes requested, merged or closed — each linking to the change request.

Was this helpful?

Last updated

View as Markdown