# mt mv

A task’s id is its file stem, so renaming the file renames the task. Rename it by hand and every `links:` edge to it breaks. `mt mv` renames it and rewrites those edges in the same checked write. `mt check` then finds every edge intact. To change the `title:` field, use `mt set`.

Rename a task's file and update every link that points to it

Inside a git repository it runs `git mv`. It keeps the task's title and folder, and refuses a stem another task has.

`NEW_STEM` is a bare stem. `mt` drops a trailing `.typ` and refuses a path separator. `mt mv` renames a task in place, because moving it to another folder would change its [derived tags](https://mlavrinenko.github.io/mindtape/derived-tags/index.md). Before it renames anything, it refuses a stem another task already has, or a file that already exists. Inside a git repository it renames with `git mv`. That stages the rename and git keeps the file’s history. Outside git, or for an untracked file, it renames the file directly. `mt mv` rewrites every edge that points at the task in the same pass, and each edge keeps its relative prefix: `../sub/old.typ` becomes `../sub/new.typ`. `mt` checks every change before it writes.

Runs on one project and refuses a [set](https://mlavrinenko.github.io/mindtape/read-many-projects/index.md).

- `<TASK>`: The task: its stem, its hash, or the path to its file
- `<NEW_STEM>`: The new stem, given as a file name without `.typ` and without a folder
- `--dry-run`: Show what would change, without changing anything
  It shows the rename and every file whose links would change.

```
$ mt mv add-redis-client add-redis --dry-run
would move tasks/add-redis-client.typ -> tasks/add-redis.typ
would rewrite 1 link in 1 file:
  - tasks/throttle-failed-logins-per-ip.typ
dry run: nothing written
$ mt mv add-redis-client add-redis
moved tasks/add-redis-client.typ -> tasks/add-redis.typ
rewrote 1 link in 1 file
```

Every command also takes the [global flags](https://mlavrinenko.github.io/mindtape/cli/index.md#global-flags).
