> ## Documentation Index
> Fetch the complete documentation index at: https://help.decisionlog.me/llms.txt
> Use this file to discover all available pages before exploring further.

# GitHub

> Keep your decisions and your repo's ADRs in sync

If your team already keeps Architecture Decision Records in a repo, you
shouldn't have to maintain them twice. Connecting GitHub in **Settings →
Integrations** brings your existing ADRs in as decisions, and every
change you make here after that goes back out as a commit.

![A connected GitHub repository, with Sync now and Disconnect](https://mintcdn.com/decisionlog/uCRpVkyviPv9OV3e/images/integrations/github-connected.png?fit=max\&auto=format\&n=uCRpVkyviPv9OV3e\&q=85\&s=f230354327e04657c4c13227151998e2)

**Team:** Click **Connect with GitHub** and authorize the Decision Log
app - this step happens on github.com. Back in Decision Log, choose the
repository, the ADR folder (defaults to `adr`), the branch, and which
collection should hold the synced decisions. Only decisions in that
collection are synced. Existing ADRs import in the background - you can
leave the page and follow the progress in **Settings → Integrations**.
Importing doesn't notify anyone about each ADR: your Slack channel gets
one summary message instead of hundreds of "new decision" posts.

Once connected, **Sync now** saves your changes to the repository on
demand. **Disconnect** stops syncing and uninstalls the Decision Log
app from the GitHub account or organization it was installed on. Files
already saved to the repository stay untouched. To
connect again, click **Connect with GitHub** and install the app on
github.com once more, the same as the first time.

> **Note:** If another Decision Log workspace syncs through the same
> GitHub app installation, disconnecting one workspace leaves the app
> installed so the other keeps syncing.

Deleting a Team workspace disconnects GitHub the same way. Connecting and
disconnecting show up in the workspace's **Activity log**, with the repo
and who did it.

> **Note:** Only workspace owners and admins can connect, sync, or
> disconnect GitHub.

The collection GitHub syncs can't be deleted while GitHub is connected.
Disconnect GitHub first, so decisions from other collections never end up
in the repo by accident.

## Syncing

**Sync now** gathers every decision in the synced collection that changed
since the last sync and saves them to the repository as one commit, named
`Sync 12 decisions from Decision Log`. In an empty repository the first
file gets a commit of its own, because GitHub needs one before anything
else can be added. It runs in the background: a
progress bar in **Settings → Integrations** shows how far it got, and you
can leave the page.

If a sync would create more than 20 new files, Decision Log asks first and
tells you how many. That usually means decisions were added to the synced
collection in bulk, or that the repo was reconnected after its files lost
their link to your decisions (see below).

**Stop** cancels a running sync. Because everything lands in a single
commit at the very end, a stopped sync leaves the repository exactly as it
was. Only in the last second, after the commit is already on the branch,
is it too late to stop - Decision Log then tells you the changes were
saved.

When a sync finishes, a short summary says how many files were created or
updated and whether someone changed a synced file directly in the repo
since the last sync.

## Disconnecting and connecting again

Every file Decision Log writes carries a `decisionlogId` line in its
frontmatter - the decision's ID. ADRs without frontmatter get the same ID
as an invisible HTML comment at the end of the file instead, so tools like
adr-tools keep working. This ID is how Decision Log recognizes its own
files.

When you connect a repository again, files with an ID that belongs to a
decision in the chosen collection are linked to that decision instead of
being imported a second time. Only files without a matching ID become new
decisions. Decision Log never matches files by title or content, so two
ADRs that look alike are never merged. Don't edit or remove the
`decisionlogId` line by hand - a file without it is treated as a new ADR
on the next reconnect.

## Files that differ from Decision Log

Some files in the repo don't match what Decision Log would write: ADRs
imported from the repo keep their own layout, a file may have been edited
directly on GitHub, or the repo was reconnected. Decision Log never
rewrites such a file on its own. When a sync finds them, it stops and asks
first, and shows each file line by line - lines that would disappear in
red, lines that would be added in green.

* **Keep as is** leaves the files untouched. Only the `decisionlogId`
  line is added where it's missing. You won't be asked about these files
  again; a file switches to Decision Log's format the next time its
  decision is edited in Decision Log.
* **Save in Decision Log format** rewrites the files from your decisions,
  with the title, status and date in a block at the top.

If some text in a file isn't part of the decision in Decision Log - a
section the import didn't pick up, for example - the dialog warns you and
lists those files first. Saving in Decision Log format removes that text
from the file; the previous version stays in the repo's history.

Decisions you changed in Decision Log are always saved, without asking -
that's what syncing is for.

After you disconnect and connect again, Decision Log asks about these
files once more, since it starts from a fresh connection.

If you rename or move a synced file inside the ADR folder on GitHub,
Decision Log finds it again by its ID. A file deleted on GitHub isn't
brought back by a sync; it's created again only when its decision changes
in Decision Log.

> **Note:** If some files still have no ID when you click **Disconnect**,
> Decision Log warns you and asks you to confirm first.

> **Note:** The first **Sync now** after connecting adds the ID to every
> imported ADR (with **Keep as is**) or rewrites them (with **Save in
> Decision Log format**). Run it before you disconnect: a file without an
> ID is imported again as a new decision when you reconnect.

## What Decision Log can and can't do in your repo

GitHub grants app permissions per repository, not per folder. The
Decision Log app asks for one permission, **Contents: Read and write**,
and only on the repositories you pick during installation.

**What Decision Log does:**

* Reads the Markdown files in the ADR folder you chose, to import them
  as decisions.
* Creates or updates one `.md` file per decision in that folder. A
  single edit is saved as a commit named `Sync decision "…" from Decision
  Log`; **Sync now** saves everything as one commit on the branch you
  chose.
* Adds the `decisionlogId` line to ADRs it imported, without changing
  anything else in them.

**What Decision Log never does:**

* Delete files, from the ADR folder or anywhere else.
* Force-push, rewrite history, or create, rename or delete branches.
* Write over an unrelated file. A new decision whose file name is
  already taken in the folder is saved under a new name, such as
  `my-decision-2.md`.
* Touch repositories you didn't select.

**What the permission itself doesn't allow:** deleting or archiving a
repository, changing its settings, collaborators or branch protection,
and reading or changing issues, pull requests or Actions.

**Synced files follow Decision Log.** The files Decision Log created, and
the ADRs that were in the folder when you connected (they're imported as
decisions), mirror your decisions from then on:

* When a synced decision changes in Decision Log, its file is rewritten in
  Decision Log's Markdown format. An imported ADR keeps its original
  formatting until its decision is edited in Decision Log.
* If someone edits a synced file directly in the repo, the next sync
  replaces that edit with the decision from Decision Log, and the sync
  report lists the file as changed in the repo.

The previous version always stays in the repo's history. To change a
synced decision, edit it in Decision Log.

Every change is an ordinary commit, so you can review or revert it like
any other.

**To keep access as small as possible:**

* On github.com, choose **Only select repositories** and pick just the
  repository that holds your ADRs.
* If your main branch requires pull requests, sync to a separate branch
  (for example `adr-sync`) and merge it through a pull request.
* Keep your own backups of important repositories. The
  [Terms of Service](https://decisionlog.me/terms) explain how
  integrations with third-party services are covered.

## FAQ

**Does disconnecting delete anything from the repo?** No - files already
saved to the repository stay there.

**I reconnected and my ADRs were imported twice. Why?** Those files had no
`decisionlogId` yet - they were imported from the repo and no sync ran
before you disconnected. Delete the extra decisions in Decision Log, then
run **Sync now** so every file gets its ID.

**Why didn't my team get a Slack message for every imported ADR?**
Importing posts one summary to your Slack channel instead. The ADRs
already existed, so announcing each one as a new decision would only flood
the channel.

**Can I stop a sync that's taking long?** Yes - click **Stop**. The
repository stays unchanged.

**Do I need to remove the app on GitHub after disconnecting?** No.
Decision Log uninstalls it for you. If the app was already removed on
GitHub, disconnecting still works.

## Related

* **[Slack](https://help.decisionlog.me/integrations/slack.md)** - Post decisions to a channel and turn Slack messages into decisions
* **[Members and roles](https://help.decisionlog.me/team/members-and-roles.md)** - Who counts as an owner or admin
* **[Workspaces](https://help.decisionlog.me/team/workspaces.md)** - Rename or delete a workspace and see its activity log


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.