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

# Pull app

> Pull the latest app files from the server

Pull the latest version of your application files from the [BRICKS](https://bricks.tools) server to your local project.

## Pull files from the server

1. Click **Actions** > **Pull** in the chat panel header
2. Review the warnings in the confirmation dialog
3. Click **Pull** or **Force Pull**

The dialog offers two modes. **Pull** is the default safe path; **Force Pull** is the legacy in-place overwrite.

### Pull (default)

**Pull** lands the server's changes on your `main` branch through a temporary `BRICKS_PROJECT_try-pull-application` branch (or `…try-pull-module` for modules):

1. Refuses to run when you have unstaged changes — commit or stash them first.
2. Aborts with "Already up to date" when your `HEAD` already matches the server commit.
3. Creates the try-pull branch from your last synced commit (see **Sync marker** below), applies the new files, and commits them.
4. Checks out `main` and 3-way-merges the try-pull branch back in.
5. Deletes the try-pull branch so you do not need to manage a side branch.
6. Records the new `HEAD` as the next sync point.

### Resolving merge conflicts

When the merge produces conflicts, CTOR commits the conflict markers on `main` (with `--no-verify` so pre-commit hooks do not reject the intermediate state) and the dialog surfaces a **Pull warning**. The auto-compile banner then reports the conflict markers as typecheck errors — resolve them in place on `main` and the banner clears as you fix each file.

### Sync marker

`.bricks/.last-pushed-commit` is a per-clone file that records the commit you last synced with the server. CTOR updates it after every successful deploy, Update Config, or non-force pull, and prefers it as the merge base on the next pull. When the marker is missing (a fresh clone, for example), CTOR falls back to the server's last commit id; when neither is reachable in your local history, the try-pull branch is created from `HEAD` and the 3-way merge collapses to the same result.

### Force Pull

**Force Pull** stays on the current branch, auto-commits any unstaged changes (as `chore(force-pull): saved unstaged changes before pull`), and overwrites local files with the server version. It does not touch the sync marker — that is owned by the deploy, Update Config, and non-force Pull flows.

<Warning>
  **Force Pull** overwrites local changes that conflict with the server version. Use it only when you do not need to keep your local edits.
</Warning>
