> Index of every page on this site: [llms.txt](https://docs.a-line.cloud/llms.txt)

# Recovery

> Undo a change, back out of a removal, fix a failed sync and recover from a rewritten branch.

The tracked branch is the source of truth, so most mistakes are undone the
same way they were made: with a commit.

## Roll back a change

Revert the commit and push the revert to the tracked branch:

```bash
git revert <commit>
git push
```

The next sync applies the files as they are after the revert, the same as
any other push. Do not reset the branch to an older commit and force-push it:
a sync only applies commits that descend from the last commit it applied
(see [rewritten history](#rewritten-history)).

## Removing a file

Deleting a file asks for the resource to go, but most removals do not take
effect on the push alone:

- **App with volumes**: the app is marked for deletion and waits for an
  environment admin to confirm it. An app whose last file set
  `allow_delete: true` with `delete_data` is held the same way.
- **App without volumes**: the app is removed by the sync, like a delete in
  the dashboard. Its backups are kept.
- **Environment**: held until an organization admin confirms it.
- **Bucket, storage or site**: deleted only when the file asked for it
  (`delete: true` or `allow_delete: true`), and then held until someone
  confirms. Otherwise the link stops managing it and it keeps running,
  editable in the dashboard again.
- **Domain or DNS zone**: never deleted. The domain or zone and its
  records stay, and the link stops managing it, so it is editable in the
  dashboard again. See
  [removing a domain file](/iac/domains#removing).
- **Project**: never removed from Git. Unlink the project and delete it in
  the dashboard.

To back out of a held removal, put the file back (for example with
`git revert`) before anyone confirms. The next sync withdraws the held
change, and an app marked for deletion is restored. You can also dismiss the
held change; a later sync holds it again if the files still ask for it.
[Held changes](/iac/gitops#held) lists who can confirm what.

## A sync failed

When a sync cannot apply a commit, nothing from that commit is applied and
the link keeps the last commit it applied. The error is shown:

- on the link in the dashboard (the project's link settings, or the
  infrastructure link's card under the organization's IaC settings);
- as a failing check on the commit in GitHub.

Fix the files and push again. The next commit that loads is applied as
usual. Links are also checked every few minutes, so a push whose
notification never arrived is still picked up.

## Rewritten history

A sync only applies a commit that descends from the last commit it applied.
After a force-push, a rebase of the tracked branch or a reset to an older
commit, the sync refuses with one of:

- `The branch history was rewritten: <commit> does not descend from the last applied commit <commit>`
- `... is behind the last applied commit ...`
- `The last applied commit <commit> is no longer in the repository`

The link keeps its last applied state and stays failed until it can sync
again. To recover, an admin (an environment admin for a project link, an
organization admin for an infrastructure link) selects **Accept current tip
as baseline** on the link and confirms with a second factor. The refused
commit becomes the new baseline and a sync is queued that applies it. The
commits between the old baseline and the tip are not reviewed one by one:
the sync applies the difference between the tip and the live state. API keys
cannot accept a baseline. Unlinking and linking again also works.

To avoid this, protect the tracked branch against force-pushes and roll back
with `git revert` instead.
