# Work on a version

> Start a version, change its open candidate, and save or restore candidates until the version is ready.

A version is a semantic version target of a project, such as `1.4.0`. Each candidate is one attempt at the release of that version, and you promote the candidate that is ready. See [Promote a release](/releases/promote).

Genesis must be complete before you can start a version. See [Create the first release](/releases/genesis).

## The version cycle

The version cycle of a version holds every candidate of that version and, at the end, its promoted release. Patchbay numbers the candidates `rc.1`, `rc.2` and so on, and the cycle has one of three statuses:

| Status | Meaning |
|---|---|
| **In progress** | The version has an open candidate. |
| **Released** | A candidate was promoted. |
| **Abandoned** | The version ended without a release. |

A version cycle has at most one open candidate, and only the open candidate can change. The header of a candidate page shows its status:

- **Active**: the open candidate.
- **Superseded**: a later candidate replaced it, and it is read-only.
- **Promoted**: it is the promoted release of the version.
- **Archived**: the version was abandoned while this candidate was open.

## Start a version

You need the **Release manager** role or higher on the project.

1. Open the project. The **Releases** list shows every version.
2. Click **Release** (the plus sign) under the list. You can also press `Cmd+K` (or `Ctrl+K`) and select **New release**.
3. Type the version in the **Version, e.g. 0.1.0** field, and then press `Enter`. Patchbay creates `rc.1` and opens it.

The version must be a semantic version with three numbers, such as `2.1.0`. Patchbay also accepts a leading `v`, a pre-release part and a build part, for example `v2.1.0-beta.1`. The name `genesis` is reserved, and you cannot start a version that was already released or abandoned.

The baseline is the latest promoted release of the project when you start the version, and it stays the same for the whole version cycle. When you type a complete version, Patchbay shows the baseline next to the field, unless the baseline is Genesis.

`rc.1` starts with the components of the baseline and their refs. Patchbay does not copy the components that the baseline removed.

## Tracked and pinned refs

Each component of a candidate has a ref. A tracked ref is a branch or a tag, so it can move, and a pinned ref is a commit, which never moves.

<Media id="tracked-vs-pinned" label="An Open Candidate with one Component on the main branch that moves to a new commit after a push, next to a Component pinned to a commit." />

The open candidate follows its tracked refs, so when a tracked branch or tag moves on GitHub, Patchbay moves the component to the new commit. A superseded candidate and a promoted release do not follow refs, and each of their components keeps its saved commit.

If a tracked branch or tag is deleted, the row shows **Ref missing** and the candidate keeps the last saved commit for that component. Everyone who can see the project also gets a notification in the inbox. To correct it, select another ref for the component.

## Change the open candidate

You need the **Contributor** role or higher on the project. Each change updates the release diff of the candidate, as [Compare releases](/releases/compare) explains.

- To change a ref, click the ref at the end of a component row, choose **Branch**, **Tag** or **Commit**, and then select a value.
- To change the ref of a selected row from the keyboard, press `Cmd+K` and select **Edit reference for** followed by the component name.
- To add or remove a component, use the component editor. See [Add components](/projects/components).

## Save a candidate and start the next one

A new candidate saves the current open candidate as it is, so use it when you want to keep the exact commits that you tested. You need the **Release manager** role or higher on the project.

1. Open the version, and then open its open candidate.
2. Press `Cmd+K` (or `Ctrl+K`) and select **New candidate**. The dialog lists the components of the new candidate and the pull requests that it does not include yet.
3. Click **New candidate** to confirm. The current candidate becomes superseded and read-only.

The new candidate copies the branches and commits of the current one.

## Restore a superseded candidate

While the version is **In progress**, you can go back to a superseded candidate. Patchbay does not change the old candidate, and it creates a new candidate from it. You need the **Release manager** role or higher on the project.

1. On a candidate page, click the candidates property in the header, and then select the superseded candidate.
2. Press `Cmd+K` (or `Ctrl+K`) and select **Restore as new candidate**.
3. Read the dialog, and then click **Restore as new candidate**.

The new candidate copies the saved branches and commits of the old one, and the current open candidate becomes read-only. A component that was added after the old candidate shows as removed.

## End the version

A version ends in one of two ways:

- You promote its open candidate. See [Promote a release](/releases/promote).
- You abandon it. See [Abandon a version](/releases/promote#abandon-a-version).

Index of all pages: https://patchbay.unbrikd.com/docs/llms.txt
