# mt import

`mt import` writes each record through the same destination guard as `mt add`. It refuses a template directory, a reserved `.mindtape` or `.git` path, a destination that is itself a symlink, and a new file under a Git ignore rule. [Which files count as tasks](https://mlavrinenko.github.io/mindtape/concepts/index.md#which-files-count-as-tasks) defines the paths that qualify.

`--dir <path>` sends the whole batch there. A relative path resolves from the project root, and `mt import` takes an absolute one as-is. Without it, each record keeps the folder its `file` field names. `mt import` refuses the removed `--into` and `--to` with a hint to `--dir`.

Import tasks from JSON (the `mt ls --json` format), checking them all first

mt checks the whole batch against your project's rules before it writes any task.

To bring tasks in from another tracker, see [Import & export](https://mlavrinenko.github.io/mindtape/import-export/index.md). It describes the JSON format, `jq` adapters for Taskwarrior and GitHub Issues, and what a round trip keeps.

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

- `[FILE]`: The JSON file to import, or `-` for stdin
  `mt ls --json` writes this format.
  `default: -`
- `--dir <DIR>`: The directory to write every task in
  A relative path resolves from the project root, and `mt import` takes an absolute one as-is. Without it, each task goes where its `file` field says, or to the first root.
- `--into <DIR>`: Removed. Use `--dir`
- `--to <SUBDIR>`: Removed. Use `--dir`
- `--dry-run`: Show what `mt import` would write, without writing anything
- `--status <NAME>`: The status, dated today, for a task that has none
- `--map <OLD=NEW>…`: Rename a status on the way in, as `OLD=NEW`
  Repeat it for each status.
  `repeatable`
- `--drop-unmapped`: Drop tags your project doesn't allow, instead of reporting an error
  Without it, mt keeps those tags and reports an error.

```sh
mt import export.json --dry-run   # from a file, preview only
mt import < export.json           # canonical JSON from stdin
jq -f contrib/jq/import/taskwarrior.jq task-export.json | mt import   # a Taskwarrior export
```

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