# ant update

```sh
ant update              # every entry of the project file
ant update <name>...    # the entries named
```

`ant update` raises entries of the project file, `ant.json`, to the highest release of their
[lines](https://ant-lang.org/docs/guide/packages.md#versions). It reads the tags of each repository, writes the new
versions to `ant.json`, selects again, fetches what the store lacks, and writes `ant.lock`.

```sh
$ ant update
ant: fetching example.com/slug 1.4.0
- example.com/slug 1.2.0
+ example.com/slug 1.4.0
```

- **It stays in the line.** An entry at `1.2.0` goes to the highest `1.x` release, never to `2.0.0`.
  To move an entry to another line, run [`ant add`](https://ant-lang.org/docs/tools/add.md) with the version, as
  `ant add example.com/slug@2.0.0`.
- **It never lowers a version.** An entry that is at the highest release stays as it is, and
  `ant update` then prints nothing.
- **Releases come first.** A prerelease, such as `1.5.0-rc.1`, is taken only when the line has no
  release.
- **Only your own entries move.** A package that another package asks for stays at the version that
  is asked for. To raise it, add it to your own `dependencies`.
- It changes all or nothing, as `ant add` does.

A new release reaches a project only when you ask for it, with `ant update` or `ant add`: no run
takes a version that no `ant.json` names.

## Exit status

| Exit status | When                                                                                    |
| ----------- | --------------------------------------------------------------------------------------- |
| `0`         | the files were written, or nothing had a higher release                                 |
| `1`         | a name is not a dependency, a repository cannot be reached, or there is no project file |
| `2`         | the usage is wrong: an unknown flag, or an argument that is not a name                  |

## See also

[Packages](https://ant-lang.org/docs/guide/packages.md), [`ant add`](https://ant-lang.org/docs/tools/add.md), [`ant remove`](https://ant-lang.org/docs/tools/remove.md),
[`ant lock`](https://ant-lang.org/docs/tools/lock.md)
