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

# checkout

> Switch branches and manage versions efficiently with Diversion's checkout command reference.

Checkout a branch, commit, or tag to your current workspace.

```bash theme={null}
dv checkout <ref> [--take-changes] [--shelve-changes] [--discard-changes] [--apply-shelf] [--ignore-shelf] [--nowait]
```

`<ref>` is the only mandatory parameter and the options are:

`<branch_name>`, or `<branch_id>` if you want to checkout a branch.

`<commit_id>` or `<tag_id>`, if you're checking either of them.

When checking out, there might be some local pending changes or incoming shelved changes. You can specify what to do in each case:

`[--take-changes]` If your worskpace contains any changes, take them with you to the checked out target.

`[--shelve-changes]` If your workspace contains any changes, shelve them for later use.

`[--discard-changes]` Discard any changes in the workspace.

`[--apply-shelf]` If the branch to be checked out contains any previously shelved changes, un-shelve them after check out.

`[--ignore-shelf]` If the branch to be checked out contains any previously shelved changes, ignore them and don't prompt to apply them.

By default, checkout waits for the checked-out files to finish syncing to your local workspace:

`[--nowait]` Return immediately without waiting for the local file sync to complete.
