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

# Goto

> Go back to a previous save

Lets you jump back to an older version of the project, either briefly or permanently.

## Usage

```bash theme={null}
ag goto <commit> [options]
```

## Arguments

| Argument | What it is                           | Required? |
| -------- | ------------------------------------ | --------- |
| `commit` | A save ID (like `abc1234`) or `HEAD` | Yes       |

## Options

| Option      | What it does                                |
| ----------- | ------------------------------------------- |
| `--reset`   | Permanently roll back to the old version    |
| `--stay`    | Stay on the old version (don't auto-return) |
| `--preview` | Show what would happen without doing it     |

## Finding a save ID

Use `ag info` to see the save history. Each save has a short ID like `abc1234` or `def5678`. That's the "commit" you use with `goto`.

## Temporary visit (default)

The default mode. You peek at an old version, and when you press Enter, you come back:

```bash theme={null}
ag goto abc1234
```

**What happens:**

1. Any unsaved changes are put aside (safe and sound)
2. You're taken to the old version
3. You can look around, check files, etc.
4. Press **Enter** to return to where you were
5. Your unsaved changes come back automatically

## Stay on the old version

If you want to look around without auto-returning:

```bash theme={null}
ag goto abc1234 --stay
```

**What happens:**

1. You're taken to the old version
2. You stay there until you run `ag goto HEAD`
3. Your unsaved changes are put aside temporarily

To get back:

```bash theme={null}
ag goto HEAD
```

## Permanently roll back (--reset)

If you want to make the old version the current version:

```bash theme={null}
ag goto abc1234 --reset
```

**Warning:** This is destructive! Anchor4Git will ask you to confirm.

**What happens:**

1. Any unsaved changes are auto-saved first
2. Your workspace is replaced with the old version
3. A new save is created called "RESET of: \[old save message]"
4. You can keep working from this point

## Return to HEAD

To come back to the latest version from a `--stay` session:

```bash theme={null}
ag goto HEAD
```

> `HEAD` is a special word that means "the latest save."

## Preview mode

To see what would happen:

```bash theme={null}
ag goto abc1234 --preview
```

Shows the commit details, whether reset mode is on, and whether stay mode is on.

## Examples

```bash theme={null}
# Briefly check an old version
ag goto abc1234

# Look around without auto-return
ag goto abc1234 --stay

# Come back after --stay
ag goto HEAD

# Permanently roll back
ag goto abc1234 --reset

# See what goto would do
ag goto abc1234 --preview
```
