---
title: Source Control
description: Review what the agent changed, then commit, push and open pull requests without leaving the chat. Syncing never stashes and never force-pushes.
sidebar:
  icon: git-branch
---

Source Control (`mod+d`) holds your changes, each turn's changes and the branch's history. It's where
you review what an agent did before it goes anywhere.

## Review and commit

### Changes

**Changes** lists staged and unstaged files by folder. Select files to **Stage**, **Unstage** or
**Discard** them, and click one for its diff, unified or side by side. **Edit** opens the working
file. A folder without Git offers **Initialize Repository**.

### Commit

The commit box commits what's staged, or stages everything when nothing is. Press `mod+enter`, or
choose **Commit & push** from the **Commit** menu.

Glade can write the message from the staged changes, or from all changes when nothing is staged. Pick
the model it uses in **Settings → Git & files**.

## Sync with the remote

### Push, pull and sync

Next to **Fetch**, one button names the next step, with commit counts: **Publish branch**, **Pull**,
**Push**, **Sync** when the branch has diverged, or **Up to date**.

Push fetches first, then fast-forwards or rebases your unpublished commits before pushing. It never
stashes on its own and never force-pushes. If a rebase hits conflicts, Source Control lists the files
with **Continue** and **Abort**.

### Publish to GitHub

A repository without a remote gets **Publish to GitHub** instead. Pick your account or an
organization, name the repository and choose private (the default) or public. It needs the GitHub CLI
signed in with `gh auth login`.

## History

**History** lists the branch's commits: a green arrow for pushed ones, a yellow icon for local ones.
Select a commit to see its files and diffs. The menu on the latest unpublished commit can undo it and
keep its changes in your working tree.

## Review guides

A review guide walks you through a pull request or your branch in the order it makes sense to read,
instead of file by file.

### Open one

- **On a pull request:** open its **Guide** tab.
- **On your branch:** **Review guide for this branch** in the Source Control toolbar.

Glade writes the guide with your Git generation model, set in **Settings → Git & files**. **Rewrite**
writes it again.

### Read it

The guide opens with an overview: what the change does, before and after. Then come its **stops**,
groups of related changes in reading order. **Look closely** flags the spots that need your call.

**Start review** opens the first stop. **Next stop** marks the one you're on as viewed, or toggle it
yourself, and **Continue** picks up at the first stop you haven't seen. From a chat, **Ask about this
stop** hands that stop to the agent as a question.

## Undo a turn

Before every message you send, Glade snapshots the chat's working tree. That's what makes each turn
reviewable and reversible.

### Review and undo a turn

When a turn changes files, a change card in the transcript lists them. **Review** opens that turn's
diff, and **Undo** restores the files it changed.

### Rewind the chat

Edit any earlier message and send it again. Glade drops the turns after it and asks whether to **Keep
files** as they are or **Restore files** to how they were before that message.

:::warning
If another chat worked in the same folder since then, the dialog says so and marks the files edited
later. Restoring would undo those edits too.
:::

Snapshots leave your Git staging area alone, and a very large repository can skip one (the chat says
so). For anything you can't afford to lose, a commit is still the strongest boundary.

## Pull requests

### Review on GitHub, from Glade

`mod+shift+g` lists the project's pull requests, yours first, with their checks and reviews. Each
opens as a tab with a summary and its changes. **Fix**, **Resolve** and **Address** turn failing
checks or review comments into a message for the agent, and **Merge** appears once nothing blocks it.

### The next step, one shortcut away

The chat's Environment panel shows the branch's next step: commit, push, create a PR or merge.
`mod+ctrl+p` on macOS, or `ctrl+alt+p`, runs it.
